Docs: send-email's usage text and man page mention same options
[gitweb.git] / t / t5510-fetch.sh
index 20257428eb0a98f639e7d373f1d00ad91d7c16ad..9aae4965dac0f2bf4bb8684c4b8d43dcb60529e9 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,7 +96,7 @@ test_expect_success 'fetch following tags' '
 
 '
 
-test_expect_failure 'fetch must not resolve short tag name' '
+test_expect_success 'fetch must not resolve short tag name' '
 
        cd "$D" &&
 
@@ -103,20 +104,20 @@ test_expect_failure 'fetch must not resolve short tag name' '
        cd five &&
        git init &&
 
-       git fetch .. anno:five
+       test_must_fail git fetch .. anno:five
 
 '
 
-test_expect_failure 'fetch must not resolve short remote name' '
+test_expect_success 'fetch must not resolve short remote name' '
 
        cd "$D" &&
-       git-update-ref refs/remotes/six/HEAD HEAD
+       git update-ref refs/remotes/six/HEAD HEAD
 
        mkdir six &&
        cd six &&
        git init &&
 
-       git fetch .. six:six
+       test_must_fail git fetch .. six:six
 
 '
 
@@ -139,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 ' '
@@ -235,9 +236,91 @@ 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_expect_success 'auto tag following fetches minimum' '
+
+       cd "$D" &&
+       git clone .git follow &&
+       git checkout HEAD^0 &&
+       (
+               for i in 1 2 3 4 5 6 7
+               do
+                       echo $i >>file &&
+                       git commit -m $i -a &&
+                       git tag -a -m $i excess-$i || exit 1
+               done
+       ) &&
+       git checkout master &&
+       (
+               cd follow &&
+               git fetch
+       )
+'
+
 test_done