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" '
'
+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 &&
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 ' '
# 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
'
do
echo "$(git rev-parse --verify $h) $h"
done >expect &&
- diff -u expect actual
+ 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
'