@matheusbsbs / matheus-bagliano / commits / 69add8e6d2
Fork 0

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>

Junio C Hamano committed Jan 20, 2010 at 01:08 UTC 69add8e6d20989babdb128cf63decc10c418fcfa
1 file changed +41
t/t1506-rev-parse-upstream.sh
+41
@@ -66,4 +66,45 @@ test_expect_success '@{u} without specifying branch fails on a detached HEAD' '
66 test_must_fail git rev-parse @{u}
67 '
68
69 +test_expect_success 'checkout -b new my-side@{u} forks from the same' '
70 +(
71 + cd clone &&
72 + git checkout -b new my-side@{u} &&
73 + git rev-parse --symbolic-full-name my-side@{u} >expect &&
74 + git rev-parse --symbolic-full-name new@{u} >actual &&
75 + test_cmp expect actual
76 +)
77 +'
78 +
79 +test_expect_failure 'merge my-side@{u} records the correct name' '
80 +(
81 + sq="'\''" &&
82 + cd clone || exit
83 + git checkout master || exit
84 + git branch -D new ;# can fail but is ok
85 + git branch -t new my-side@{u} &&
86 + git merge -s ours new@{u} &&
87 + git show -s --pretty=format:%s >actual &&
88 + echo "Merge remote branch ${sq}origin/side${sq}" >expect &&
89 + test_cmp expect actual
90 +)
91 +'
92 +
93 +test_expect_failure 'branch -d other@{u}' '
94 + git checkout -t -b other master &&
95 + git branch -d @{u} &&
96 + git for-each-ref refs/heads/master >actual &&
97 + >expect &&
98 + test_cmp expect actual
99 +'
100 +
101 +test_expect_failure 'checkout other@{u}' '
102 + git branch -f master HEAD &&
103 + git checkout -t -b another master &&
104 + git checkout @{u} &&
105 + git symbolic-ref HEAD >actual &&
106 + echo refs/heads/master >expect &&
107 + test_cmp expect actual
108 +'
109 +
110 test_done