Code

t5510: add a bit more tests for fetch
authorJunio C Hamano <gitster@pobox.com>
Wed, 5 Dec 2007 05:58:42 +0000 (21:58 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Dec 2007 05:58:42 +0000 (21:58 -0800)
"git pull/fetch" that gets explicit refspecs from the command line should
not update configured tracking refs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5510-fetch.sh

index 46a9c4d95cf889990f2e6387a9838a55642bbe64..02882c1e4bdcef725b3575ccee6fb298f01c21b4 100755 (executable)
@@ -253,4 +253,46 @@ test_expect_success 'bundle should record HEAD correctly' '
 
 '
 
+test_expect_success 'explicit fetch should not update tracking' '
+
+       cd "$D" &&
+       git branch -f side &&
+       (
+               cd three &&
+               o=$(git rev-parse --verify refs/remotes/origin/master) &&
+               git fetch origin master &&
+               n=$(git rev-parse --verify refs/remotes/origin/master) &&
+               test "$o" = "$n" &&
+               ! git rev-parse --verify refs/remotes/origin/side
+       )
+'
+
+test_expect_success 'explicit pull should not update tracking' '
+
+       cd "$D" &&
+       git branch -f side &&
+       (
+               cd three &&
+               o=$(git rev-parse --verify refs/remotes/origin/master) &&
+               git pull origin master &&
+               n=$(git rev-parse --verify refs/remotes/origin/master) &&
+               test "$o" = "$n" &&
+               ! git rev-parse --verify refs/remotes/origin/side
+       )
+'
+
+test_expect_success 'configured fetch updates tracking' '
+
+       cd "$D" &&
+       git branch -f side &&
+       (
+               cd three &&
+               o=$(git rev-parse --verify refs/remotes/origin/master) &&
+               git fetch origin &&
+               n=$(git rev-parse --verify refs/remotes/origin/master) &&
+               test "$o" != "$n" &&
+               git rev-parse --verify refs/remotes/origin/side
+       )
+'
+
 test_done