Download raw body.
Problem with got update?
On Tue, Jan 05, 2021 at 10:53:05PM +0200, Timo Myyrä wrote:
> Stefan Sperling <stsp@stsp.name> [2021-01-04, 11:42 +0100]:
>
> > On Sun, Jan 03, 2021 at 10:13:07PM +0200, Timo Myyrä wrote:
> >
> >> Hi,
> >>
> >> While figuring out how to get single files contents at given commit I
> >> attempted to use update command. It seems to behave oddly when running
> >> repeatedly with same arguments.
> >>
> >> Is this expected?
> >
> > What did you expect instead?
> >
>
> Hmm, well looking at man page I would have expected either the just
> README.org be reverted to commit
> bf832809c3806e9b69db972abaa3d38fd427573e if straight file can be given
> as path argument. Or if file is not an valid path argument I would have
> expected some error or nothing happening. Now it would seem to ...
> delete one file from work tree after each invocation of the command
> which is the odd part.
>
> timo
OK, I see it now, thank you!
I did not notice the mismatch between the path argument and the file
which was deleted.
It looks like update -c with a path isn't covered by the test suite.
I have tried to add test coverage for this bug but I cannot trigger it.
My attempt is shown below.
Could you try to write a script that triggers the bug, starting with
an empty repo? Or even add a test case to our test suite (which is
just a shell script)?
In any case, thanks for pointing this out! :)
diff 1255c02f3e117fa4fd07f9cc6fbcf62383755e5d /home/stsp/src/got
blob - a52e26753f5fdda870b159596d715fa7bae988c0
file + regress/cmdline/update.sh
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
@@ -1089,6 +1089,7 @@ test_update_conflict_wt_rm_vs_repo_rm() {
test_update_partial() {
local testroot=`test_init update_partial`
+ local base_commit=`git_show_head $testroot/repo`
got checkout $testroot/repo $testroot/wt > /dev/null
ret="$?"
@@ -1156,6 +1157,29 @@ test_update_partial() {
return 1
fi
+ echo "U alpha" > $testroot/stdout.expected
+ echo "Updated to commit $base_commit" >> $testroot/stdout.expected
+
+ (cd $testroot/wt && got update -c $base_commit alpha > $testroot/stdout)
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "alpha" > $testroot/content.expected
+ cat $testroot/wt/alpha > $testroot/content
+
+ cmp -s $testroot/content.expected $testroot/content
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/content.expected $testroot/content
+ test_done "$testroot" "$ret"
+ return 1
+ fi
test_done "$testroot" "$ret"
}
>
> >> tmy@asteroid dotfiles $ got update -c bf832809c3806e9b69db972abaa3d38fd427573e README.org
> >> D .abclrc
> >> Updated to commit bf832809c3806e9b69db972abaa3d38fd427573e
> >> tmy@asteroid dotfiles $ got update -c bf832809c3806e9b69db972abaa3d38fd427573e README.org
> >> D .clisprc
> >> Updated to commit bf832809c3806e9b69db972abaa3d38fd427573e
> >> tmy@asteroid dotfiles $ got update -c bf832809c3806e9b69db972abaa3d38fd427573e README.org
> >> D .config/conky/scripts/conky_lua_scripts.lua
> >> Updated to commit bf832809c3806e9b69db972abaa3d38fd427573e
> >> tmy@asteroid dotfiles $ got update -c bf832809c3806e9b69db972abaa3d38fd427573e README.org
> >> D .config/fbpanel/default
> >> Updated to commit bf832809c3806e9b69db972abaa3d38fd427573e
> >> tmy@asteroid dotfiles $ got update -c bf832809c3806e9b69db972abaa3d38fd427573e README.org
> >> D .config/fontconfig/fonts.conf
> >> Updated to commit bf832809c3806e9b69db972abaa3d38fd427573e
> >> tmy@asteroid dotfiles $
> >>
> >> But I found the got cat in the end so all is well.
> >>
> >> Timo
> >>
> >>
>
Problem with got update?