X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3200-branch.sh;h=2147eacc5057128facc08816a2980646bed28ec5;hb=a79b8b6623288f7d5409ad749cc6553976a4f0e8;hp=38a90adad6874d0073059da542835df210172938;hpb=d82b21b57a50f7820c57a13c09232077365095c7;p=git.git diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 38a90adad..2147eacc5 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -14,10 +14,10 @@ test_expect_success \ 'prepare a trivial repository' \ 'echo Hello > A && git update-index --add A && - git-commit -m "Initial commit." && + git commit -m "Initial commit." && echo World >> A && git update-index --add A && - git-commit -m "Second commit." && + git commit -m "Second commit." && HEAD=$(git rev-parse --verify HEAD)' test_expect_success \ @@ -78,13 +78,13 @@ test_expect_success \ test_expect_success 'git branch -m o/o o should fail when o/p exists' ' git branch o/o && git branch o/p && - ! git branch -m o/o o + test_must_fail git branch -m o/o o ' test_expect_success 'git branch -m q r/q should fail when r exists' ' git branch q && git branch r && - ! git branch -m q r/q + test_must_fail git branch -m q r/q ' mv .git/config .git/config-saved @@ -110,20 +110,20 @@ test_expect_success \ test_expect_success 'config information was renamed, too' \ "test $(git config branch.s.dummy) = Hello && - ! git config branch.s/s/dummy" + test_must_fail git config branch.s/s/dummy" test_expect_success \ 'git branch -m u v should fail when the reflog for u is a symlink' ' git branch -l u && mv .git/logs/refs/heads/u real-u && ln -s real-u .git/logs/refs/heads/u && - ! git branch -m u v + test_must_fail git branch -m u v ' test_expect_success 'test tracking setup via --track' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track my1 local/master && test $(git config branch.my1.remote) = local && test $(git config branch.my1.merge) = refs/heads/master' @@ -131,7 +131,7 @@ test_expect_success 'test tracking setup via --track' \ test_expect_success 'test tracking setup (non-wildcard, matching)' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/master:refs/remotes/local/master && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track my4 local/master && test $(git config branch.my4.remote) = local && test $(git config branch.my4.merge) = refs/heads/master' @@ -139,7 +139,7 @@ test_expect_success 'test tracking setup (non-wildcard, matching)' \ test_expect_success 'test tracking setup (non-wildcard, not matching)' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/s:refs/remotes/local/s && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track my5 local/master && ! test "$(git config branch.my5.remote)" = local && ! test "$(git config branch.my5.merge)" = refs/heads/master' @@ -148,26 +148,16 @@ test_expect_success 'test tracking setup via config' \ 'git config branch.autosetupmerge true && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch my3 local/master && test $(git config branch.my3.remote) = local && test $(git config branch.my3.merge) = refs/heads/master' -test_expect_success 'avoid ambiguous track' ' - git config branch.autosetupmerge true && - git config remote.ambi1.url = lalala && - git config remote.ambi1.fetch = refs/heads/lalala:refs/heads/master && - git config remote.ambi2.url = lilili && - git config remote.ambi2.fetch = refs/heads/lilili:refs/heads/master && - git branch all1 master && - test -z "$(git config branch.all1.merge)" -' - test_expect_success 'test overriding tracking setup via --no-track' \ 'git config branch.autosetupmerge true && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track my2 local/master && git config branch.autosetupmerge false && ! test "$(git config branch.my2.remote)" = local && @@ -183,7 +173,7 @@ test_expect_success 'no tracking without .fetch entries' \ test_expect_success 'test tracking setup via --track but deeper' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/o/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o/o || git fetch local) && git branch --track my7 local/o/o && test "$(git config branch.my7.remote)" = local && test "$(git config branch.my7.merge)" = refs/heads/o/o' @@ -210,7 +200,7 @@ test_expect_success \ test_expect_success \ 'branch from non-branch HEAD w/--track causes failure' \ - '!(git branch --track my10 HEAD^)' + 'test_must_fail git branch --track my10 HEAD^' # Keep this test last, as it changes the current branch cat >expect <> .git/config && + test_must_fail git branch && + git config --unset branch.autosetuprebase +' + test_done