Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-03-26 23:43:05 +0400
committerJunio C Hamano <gitster@pobox.com>2013-03-26 23:43:05 +0400
commit307d68e275d21b7e54d464f1e372b33e9444fef2 (patch)
tree6441c3095c1a86b51fccacd0aad284e8ad3e923a /t
parent6201eb3e65ae6bc9cd14f3497cd3ca12ffc8fbd3 (diff)
parent8efb8899cfe866dddb3659b9e0a94232161db65e (diff)
Merge branch 'nd/branch-error-cases' into maint
"git branch" had more cases where it did not bother to check nonsense command line parameters. * nd/branch-error-cases: branch: segfault fixes and validation
Diffstat (limited to 't')
-rwxr-xr-xt/t3200-branch.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f3e0e4a38c..12f1e4a63c 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -42,6 +42,10 @@ test_expect_success \
'git branch a/b/c should create a branch' \
'git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c'
+test_expect_success \
+ 'git branch HEAD should fail' \
+ 'test_must_fail git branch HEAD'
+
cat >expect <<EOF
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
EOF
@@ -388,6 +392,14 @@ test_expect_success \
'git tag foobar &&
test_must_fail git branch --track my11 foobar'
+test_expect_success '--set-upstream-to fails on multiple branches' \
+ 'test_must_fail git branch --set-upstream-to master a b c'
+
+test_expect_success '--set-upstream-to fails on detached HEAD' \
+ 'git checkout HEAD^{} &&
+ test_must_fail git branch --set-upstream-to master &&
+ git checkout -'
+
test_expect_success 'use --set-upstream-to modify HEAD' \
'test_config branch.master.remote foo &&
test_config branch.master.merge foo &&
@@ -417,6 +429,15 @@ test_expect_success 'test --unset-upstream on HEAD' \
test_must_fail git branch --unset-upstream
'
+test_expect_success '--unset-upstream should fail on multiple branches' \
+ 'test_must_fail git branch --unset-upstream a b c'
+
+test_expect_success '--unset-upstream should fail on detached HEAD' \
+ 'git checkout HEAD^{} &&
+ test_must_fail git branch --unset-upstream &&
+ git checkout -
+'
+
test_expect_success 'test --unset-upstream on a particular branch' \
'git branch my15
git branch --set-upstream-to master my14 &&