diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-10-23 13:32:50 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-10-23 13:32:50 -0700 |
commit | 74051fa805b2b4aa6a0c2e6d4663dc8969e80967 (patch) | |
tree | 9cfef445e4c0d2eed38d7f739157a848921ea697 /t | |
parent | 6ba0d9551a2963a6fed83b90b55a373d79ef46d0 (diff) | |
parent | b0f49ff13033621af06af742e3615fe905833562 (diff) | |
download | git-74051fa805b2b4aa6a0c2e6d4663dc8969e80967.tar.gz git-74051fa805b2b4aa6a0c2e6d4663dc8969e80967.tar.xz |
Merge branch 'jh/checkout-auto-tracking' into maint
"git branch --track" had a minor regression in v1.8.3.2 and later
that made it impossible to base your local work on anything but a
local branch of the upstream repository you are tracking from.
* jh/checkout-auto-tracking:
t3200: fix failure on case-insensitive filesystems
branch.c: Relax unnecessary requirement on upstream's remote ref name
t3200: Add test demonstrating minor regression in 41c21f2
Refer to branch.<name>.remote/merge when documenting --track
t3200: Minor fix when preparing for tracking failure
t2024: Fix &&-chaining and a couple of typos
Diffstat (limited to 't')
-rwxr-xr-x | t/t2024-checkout-dwim.sh | 6 | ||||
-rwxr-xr-x | t/t3200-branch.sh | 38 |
2 files changed, 40 insertions, 4 deletions
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh index dee55e428..094b92ef4 100755 --- a/t/t2024-checkout-dwim.sh +++ b/t/t2024-checkout-dwim.sh @@ -104,7 +104,7 @@ test_expect_success 'setup more remotes with unconventional refspecs' ' cd repo_c && test_commit c_master && git checkout -b bar && - test_commit c_bar + test_commit c_bar && git checkout -b spam && test_commit c_spam ) && @@ -113,9 +113,9 @@ test_expect_success 'setup more remotes with unconventional refspecs' ' cd repo_d && test_commit d_master && git checkout -b baz && - test_commit f_baz + test_commit d_baz && git checkout -b eggs && - test_commit c_eggs + test_commit d_eggs ) && git remote add repo_c repo_c && git config remote.repo_c.fetch \ diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 44ec6a45f..55c9ab0b6 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -319,8 +319,9 @@ test_expect_success 'test tracking setup (non-wildcard, matching)' ' test_expect_success 'tracking setup fails on non-matching refspec' ' git config remote.local.url . && - git config remote.local.fetch refs/heads/s:refs/remotes/local/s && + git config remote.local.fetch refs/heads/*:refs/remotes/local/* && (git show-ref -q refs/remotes/local/master || git fetch local) && + git config remote.local.fetch refs/heads/s:refs/remotes/local/s && test_must_fail git branch --track my5 local/master && test_must_fail git config branch.my5.remote && test_must_fail git config branch.my5.merge @@ -870,4 +871,39 @@ test_expect_success '--merged catches invalid object names' ' test_must_fail git branch --merged 0000000000000000000000000000000000000000 ' +test_expect_success 'tracking with unexpected .fetch refspec' ' + rm -rf a b c d && + git init a && + ( + cd a && + test_commit a + ) && + git init b && + ( + cd b && + test_commit b + ) && + git init c && + ( + cd c && + test_commit c && + git remote add a ../a && + git remote add b ../b && + git fetch --all + ) && + git init d && + ( + cd d && + git remote add c ../c && + git config remote.c.fetch "+refs/remotes/*:refs/remotes/*" && + git fetch c && + git branch --track local/a/master remotes/a/master && + test "$(git config branch.local/a/master.remote)" = "c" && + test "$(git config branch.local/a/master.merge)" = "refs/remotes/a/master" && + git rev-parse --verify a >expect && + git rev-parse --verify local/a/master >actual && + test_cmp expect actual + ) +' + test_done |