summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-01-20 01:08:48 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-20 01:10:58 -0800
commit69add8e6d20989babdb128cf63decc10c418fcfa (patch)
tree07edd2aedceab6722ebad57b22f6c6524e28566a
parentIntroduce <branch>@{upstream} notation (diff)
downloadtgif-69add8e6d20989babdb128cf63decc10c418fcfa.tar.xz
t1506: more test for @{upstream} syntax
This adds a few more tests that exercises @{upstream} syntax by commands that operate differently when they are given branch name as opposed to a refname (i.e. where "master" and "refs/heads/master" makes a difference). Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t1506-rev-parse-upstream.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/t1506-rev-parse-upstream.sh b/t/t1506-rev-parse-upstream.sh
index 5abdc13bd3..a2c7f924bf 100755
--- a/t/t1506-rev-parse-upstream.sh
+++ b/t/t1506-rev-parse-upstream.sh
@@ -66,4 +66,45 @@ test_expect_success '@{u} without specifying branch fails on a detached HEAD' '
test_must_fail git rev-parse @{u}
'
+test_expect_success 'checkout -b new my-side@{u} forks from the same' '
+(
+ cd clone &&
+ git checkout -b new my-side@{u} &&
+ git rev-parse --symbolic-full-name my-side@{u} >expect &&
+ git rev-parse --symbolic-full-name new@{u} >actual &&
+ test_cmp expect actual
+)
+'
+
+test_expect_failure 'merge my-side@{u} records the correct name' '
+(
+ sq="'\''" &&
+ cd clone || exit
+ git checkout master || exit
+ git branch -D new ;# can fail but is ok
+ git branch -t new my-side@{u} &&
+ git merge -s ours new@{u} &&
+ git show -s --pretty=format:%s >actual &&
+ echo "Merge remote branch ${sq}origin/side${sq}" >expect &&
+ test_cmp expect actual
+)
+'
+
+test_expect_failure 'branch -d other@{u}' '
+ git checkout -t -b other master &&
+ git branch -d @{u} &&
+ git for-each-ref refs/heads/master >actual &&
+ >expect &&
+ test_cmp expect actual
+'
+
+test_expect_failure 'checkout other@{u}' '
+ git branch -f master HEAD &&
+ git checkout -t -b another master &&
+ git checkout @{u} &&
+ git symbolic-ref HEAD >actual &&
+ echo refs/heads/master >expect &&
+ test_cmp expect actual
+'
+
test_done