git-svn: set auto_props when renaming files
[gitweb.git] / t / t5510-fetch.sh
index aad863db7ad74ed217b3bcc76de43556f9fe7a07..de26c203270522983f9ffae4e0bde64a61898567 100755 (executable)
@@ -37,7 +37,8 @@ test_expect_success "clone and setup child repos" '
                echo "Pull: refs/heads/one:refs/heads/one"
        } >.git/remotes/two &&
        cd .. &&
-       git clone . bundle
+       git clone . bundle &&
+       git clone . seven
 '
 
 test_expect_success "fetch test" '
@@ -95,6 +96,31 @@ test_expect_success 'fetch following tags' '
 
 '
 
+test_expect_success 'fetch must not resolve short tag name' '
+
+       cd "$D" &&
+
+       mkdir five &&
+       cd five &&
+       git init &&
+
+       test_must_fail git fetch .. anno:five
+
+'
+
+test_expect_success 'fetch must not resolve short remote name' '
+
+       cd "$D" &&
+       git update-ref refs/remotes/six/HEAD HEAD
+
+       mkdir six &&
+       cd six &&
+       git init &&
+
+       test_must_fail git fetch .. six:six
+
+'
+
 test_expect_success 'create bundle 1' '
        cd "$D" &&
        echo >file updated again by origin &&
@@ -114,10 +140,10 @@ test_expect_success 'create bundle 2' '
        git bundle create bundle2 master~2..master
 '
 
-test_expect_failure 'unbundle 1' '
+test_expect_success 'unbundle 1' '
        cd "$D/bundle" &&
        git checkout -b some-branch &&
-       git fetch "$D/bundle1" master:master
+       test_must_fail git fetch "$D/bundle1" master:master
 '
 
 test_expect_success 'bundle 1 has only 3 files ' '
@@ -210,9 +236,71 @@ test_expect_success 'fetch with a non-applying branch.<name>.merge' '
 
 # the strange name is: a\!'b
 test_expect_success 'quoting of a strangely named repo' '
-       ! git fetch "a\\!'\''b" > result 2>&1 &&
+       test_must_fail git fetch "a\\!'\''b" > result 2>&1 &&
        cat result &&
        grep "fatal: '\''a\\\\!'\''b'\''" result
 '
 
+test_expect_success 'bundle should record HEAD correctly' '
+
+       cd "$D" &&
+       git bundle create bundle5 HEAD master &&
+       git bundle list-heads bundle5 >actual &&
+       for h in HEAD refs/heads/master
+       do
+               echo "$(git rev-parse --verify $h) $h"
+       done >expect &&
+       test_cmp expect actual
+
+'
+
+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" &&
+               test_must_fail 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" &&
+               test_must_fail 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_expect_success 'pushing nonexistent branch by mistake should not segv' '
+
+       cd "$D" &&
+       test_must_fail git push seven no:no
+
+'
+
 test_done