summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-01 23:20:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-04-01 23:20:45 (GMT)
commitac53196d9a1f63785de199dee4b851378510f729 (patch)
treea14bd5b92d400f27ce75e8a660372e5e3bc4f202 /t
parentf35bb7c38d546a9e8360cde53c03b0b881ab4475 (diff)
parent21b5b1e8dc9bed2b518defe29d69ebc27da4b68f (diff)
downloadgit-ac53196d9a1f63785de199dee4b851378510f729.zip
git-ac53196d9a1f63785de199dee4b851378510f729.tar.gz
git-ac53196d9a1f63785de199dee4b851378510f729.tar.bz2
Merge branch 'jh/maint-do-not-track-non-branches' into maint
* jh/maint-do-not-track-non-branches: branch/checkout --track: Ensure that upstream branch is indeed a branch
Diffstat (limited to 't')
-rwxr-xr-xt/t3200-branch.sh14
-rwxr-xr-xt/t6040-tracking-info.sh16
-rwxr-xr-xt/t7201-co.sh16
3 files changed, 31 insertions, 15 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f308235..78ce09f 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -223,6 +223,11 @@ test_expect_success \
'branch from non-branch HEAD w/--track causes failure' \
'test_must_fail git branch --track my10 HEAD^'
+test_expect_success \
+ 'branch from tag w/--track causes failure' \
+ 'git tag foobar &&
+ test_must_fail git branch --track my11 foobar'
+
# Keep this test last, as it changes the current branch
cat >expect <<EOF
0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
@@ -488,6 +493,15 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
test "z$(git config branch.myr20.rebase)" = z
'
+test_expect_success 'autosetuprebase always on detached HEAD' '
+ git config branch.autosetupmerge always &&
+ test_when_finished git checkout master &&
+ git checkout HEAD^0 &&
+ git branch my11 &&
+ test -z "$(git config branch.my11.remote)" &&
+ test -z "$(git config branch.my11.merge)"
+'
+
test_expect_success 'detect misconfigured autosetuprebase (bad value)' '
git config branch.autosetuprebase garbage &&
test_must_fail git branch
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 1e0447f..cb85132 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -74,20 +74,20 @@ test_expect_success 'status' '
grep "have 1 and 1 different" actual
'
-test_expect_success 'status when tracking lightweight tags' '
+test_expect_success 'fail to track lightweight tags' '
git checkout master &&
git tag light &&
- git branch --track lighttrack light >actual &&
- grep "set up to track" actual &&
- git checkout lighttrack
+ test_must_fail git branch --track lighttrack light >actual &&
+ test_must_fail grep "set up to track" actual &&
+ test_must_fail git checkout lighttrack
'
-test_expect_success 'status when tracking annotated tags' '
+test_expect_success 'fail to track annotated tags' '
git checkout master &&
git tag -m heavy heavy &&
- git branch --track heavytrack heavy >actual &&
- grep "set up to track" actual &&
- git checkout heavytrack
+ test_must_fail git branch --track heavytrack heavy >actual &&
+ test_must_fail grep "set up to track" actual &&
+ test_must_fail git checkout heavytrack
'
test_expect_success 'setup tracking with branch --set-upstream on existing branch' '
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 1337fa5..0c002ab 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -408,6 +408,15 @@ test_expect_success 'checkout w/--track from non-branch HEAD fails' '
test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
'
+test_expect_success 'checkout w/--track from tag fails' '
+ git checkout master^0 &&
+ test_must_fail git symbolic-ref HEAD &&
+ test_must_fail git checkout --track -b track frotz &&
+ test_must_fail git rev-parse --verify track &&
+ test_must_fail git symbolic-ref HEAD &&
+ test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
+'
+
test_expect_success 'detach a symbolic link HEAD' '
git checkout master &&
git config --bool core.prefersymlinkrefs yes &&
@@ -423,7 +432,6 @@ test_expect_success 'detach a symbolic link HEAD' '
test_expect_success \
'checkout with --track fakes a sensible -b <name>' '
git update-ref refs/remotes/origin/koala/bear renamer &&
- git update-ref refs/new/koala/bear renamer &&
git checkout --track origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
@@ -439,12 +447,6 @@ test_expect_success \
git checkout --track remotes/origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
- test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
-
- git checkout master && git branch -D koala/bear &&
-
- git checkout --track refs/new/koala/bear &&
- test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
'