diff options
Diffstat (limited to 't/t5510-fetch.sh')
-rwxr-xr-x | t/t5510-fetch.sh | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 29d59ef9fa..e3ee4bd700 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -124,7 +124,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' ' git rev-parse origin/master && git rev-parse origin/pr/42 && - git config --unset-all remote.origin.fetch + git config --unset-all remote.origin.fetch && git config remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* && git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* && @@ -447,6 +447,43 @@ test_expect_success 'explicit pull should update tracking' ' ) ' +test_expect_success 'explicit --refmap is allowed only with command-line refspec' ' + cd "$D" && + ( + cd three && + test_must_fail git fetch --refmap="*:refs/remotes/none/*" + ) +' + +test_expect_success 'explicit --refmap option overrides remote.*.fetch' ' + cd "$D" && + git branch -f side && + ( + cd three && + git update-ref refs/remotes/origin/master base-origin-master && + o=$(git rev-parse --verify refs/remotes/origin/master) && + git fetch --refmap="refs/heads/*:refs/remotes/other/*" 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 && + git rev-parse --verify refs/remotes/other/master + ) +' + +test_expect_success 'explicitly empty --refmap option disables remote.*.fetch' ' + cd "$D" && + git branch -f side && + ( + cd three && + git update-ref refs/remotes/origin/master base-origin-master && + o=$(git rev-parse --verify refs/remotes/origin/master) && + git fetch --refmap="" 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" && @@ -559,7 +596,7 @@ test_configured_prune () { test_unconfig remote.origin.prune && git fetch && git rev-parse --verify refs/remotes/origin/newbranch - ) + ) && # now remove it git branch -d newbranch && @@ -671,4 +708,17 @@ test_expect_success 'fetching a one-level ref works' ' ) ' +test_expect_success 'fetching with auto-gc does not lock up' ' + write_script askyesno <<-\EOF && + echo "$*" && + false + EOF + git clone "file://$D" auto-gc && + test_commit test2 && + cd auto-gc && + git config gc.autoPackLimit 1 && + GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 && + ! grep "Should I try again" fetch.out +' + test_done |