summaryrefslogtreecommitdiff
path: root/t/t3200-branch.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-xt/t3200-branch.sh77
1 files changed, 43 insertions, 34 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 8d87686..25e9971 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,29 @@ 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 'renaming a symref is not allowed' \
+'
+ git symbolic-ref refs/heads/master2 refs/heads/master &&
+ test_must_fail git branch -m master2 master3 &&
+ git symbolic-ref refs/heads/master2 &&
+ test -f .git/refs/heads/master &&
+ ! test -f .git/refs/heads/master3
+'
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 +140,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 +148,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,7 +157,7 @@ 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'
@@ -157,7 +166,7 @@ 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 &&
@@ -173,7 +182,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'
@@ -200,7 +209,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 <<EOF
@@ -209,7 +218,7 @@ EOF
test_expect_success \
'git checkout -b g/h/i -l should create a branch and a log' \
'GIT_COMMITTER_DATE="2005-05-26 23:30" \
- git-checkout -b g/h/i -l master &&
+ git checkout -b g/h/i -l master &&
test -f .git/refs/heads/g/h/i &&
test -f .git/logs/refs/heads/g/h/i &&
diff expect .git/logs/refs/heads/g/h/i'
@@ -228,7 +237,7 @@ test_expect_success 'autosetuprebase local on a tracked local branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase local &&
- (git show-ref -q refs/remotes/local/o || git-fetch local) &&
+ (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase &&
git branch --track myr1 mybase &&
test "$(git config branch.myr1.remote)" = . &&
@@ -240,7 +249,7 @@ test_expect_success 'autosetuprebase always on a tracked local branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase always &&
- (git show-ref -q refs/remotes/local/o || git-fetch local) &&
+ (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase2 &&
git branch --track myr2 mybase &&
test "$(git config branch.myr2.remote)" = . &&
@@ -252,7 +261,7 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote &&
- (git show-ref -q refs/remotes/local/o || git-fetch local) &&
+ (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase3 &&
git branch --track myr3 mybase2 &&
test "$(git config branch.myr3.remote)" = . &&
@@ -264,7 +273,7 @@ test_expect_success 'autosetuprebase never on a tracked local branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase never &&
- (git show-ref -q refs/remotes/local/o || git-fetch local) &&
+ (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase4 &&
git branch --track myr4 mybase2 &&
test "$(git config branch.myr4.remote)" = . &&
@@ -276,7 +285,7 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase 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 myr5 local/master &&
test "$(git config branch.myr5.remote)" = local &&
test "$(git config branch.myr5.merge)" = refs/heads/master &&
@@ -287,7 +296,7 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase never &&
- (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 myr6 local/master &&
test "$(git config branch.myr6.remote)" = local &&
test "$(git config branch.myr6.merge)" = refs/heads/master &&
@@ -298,7 +307,7 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote &&
- (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 myr7 local/master &&
test "$(git config branch.myr7.remote)" = local &&
test "$(git config branch.myr7.merge)" = refs/heads/master &&
@@ -309,7 +318,7 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
git config branch.autosetuprebase remote &&
- (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 myr8 local/master &&
test "$(git config branch.myr8.remote)" = local &&
test "$(git config branch.myr8.merge)" = refs/heads/master &&
@@ -320,7 +329,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
git config --unset branch.autosetuprebase &&
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 myr9 local/master &&
test "$(git config branch.myr9.remote)" = local &&
test "$(git config branch.myr9.merge)" = refs/heads/master &&
@@ -330,7 +339,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
git config remote.local.url . &&
git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
- (git show-ref -q refs/remotes/local/o || git-fetch local) &&
+ (git show-ref -q refs/remotes/local/o || git fetch local) &&
git branch mybase10 &&
git branch --track myr10 mybase2 &&
test "$(git config branch.myr10.remote)" = . &&
@@ -341,7 +350,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
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 myr11 mybase2 &&
test "z$(git config branch.myr11.remote)" = z &&
test "z$(git config branch.myr11.merge)" = z &&
@@ -351,7 +360,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
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 myr12 local/master &&
test "z$(git config branch.myr12.remote)" = z &&
test "z$(git config branch.myr12.merge)" = z &&
@@ -362,7 +371,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '
git config branch.autosetuprebase never &&
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 myr13 mybase2 &&
test "z$(git config branch.myr13.remote)" = z &&
test "z$(git config branch.myr13.merge)" = z &&
@@ -373,7 +382,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '
git config branch.autosetuprebase local &&
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 myr14 mybase2 &&
test "z$(git config branch.myr14.remote)" = z &&
test "z$(git config branch.myr14.merge)" = z &&
@@ -384,7 +393,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '
git config branch.autosetuprebase remote &&
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 myr15 mybase2 &&
test "z$(git config branch.myr15.remote)" = z &&
test "z$(git config branch.myr15.merge)" = z &&
@@ -395,7 +404,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '
git config branch.autosetuprebase always &&
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 myr16 mybase2 &&
test "z$(git config branch.myr16.remote)" = z &&
test "z$(git config branch.myr16.merge)" = z &&
@@ -406,7 +415,7 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '
git config branch.autosetuprebase never &&
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 myr17 local/master &&
test "z$(git config branch.myr17.remote)" = z &&
test "z$(git config branch.myr17.merge)" = z &&
@@ -417,7 +426,7 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '
git config branch.autosetuprebase local &&
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 myr18 local/master &&
test "z$(git config branch.myr18.remote)" = z &&
test "z$(git config branch.myr18.merge)" = z &&
@@ -428,7 +437,7 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' '
git config branch.autosetuprebase remote &&
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 myr19 local/master &&
test "z$(git config branch.myr19.remote)" = z &&
test "z$(git config branch.myr19.merge)" = z &&
@@ -439,7 +448,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
git config branch.autosetuprebase always &&
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 myr20 local/master &&
test "z$(git config branch.myr20.remote)" = z &&
test "z$(git config branch.myr20.merge)" = z &&