diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-01-19 23:17:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-20 01:21:47 -0800 |
commit | ae0ba8e20a2fb57299381ba2daa7c6d1863320d0 (patch) | |
tree | ffc564749098e05dc0ce4cabf265b05876a58d27 /t | |
parent | 69add8e6d20989babdb128cf63decc10c418fcfa (diff) | |
download | git-ae0ba8e20a2fb57299381ba2daa7c6d1863320d0.tar.gz git-ae0ba8e20a2fb57299381ba2daa7c6d1863320d0.tar.xz |
Teach @{upstream} syntax to strbuf_branchanme()
This teaches @{upstream} syntax to interpret_branch_name(), instead
of dwim_ref() machinery.
There are places in git UI that behaves differently when you give a local
branch name and when you give an extended SHA-1 expression that evaluates
to the commit object name at the tip of the branch. The intent is that
the special syntax such as @{-1} can stand in as if the user spelled the
name of the branch in such places.
The name of the branch "frotz" to switch to ("git checkout frotz"), and
the name of the branch "nitfol" to fork a new branch "frotz" from ("git
checkout -b frotz nitfol"), are examples of such places. These places
take only the name of the branch (e.g. "frotz"), and they are supposed to
act differently to an equivalent refname (e.g. "refs/heads/frotz"), so
hooking the @{upstream} and @{-N} syntax to dwim_ref() is insufficient
when we want to deal with cases a local branch is forked from another
local branch and use "forked@{upstream}" to name the forkee branch.
The "upstream" syntax "forked@{u}" is to specify the ref that "forked" is
configured to merge with, and most often the forkee is a remote tracking
branch, not a local branch. We cannot simply return a local branch name,
but that does not necessarily mean we have to returns the full refname
(e.g. refs/remotes/origin/frotz, when returning origin/frotz is enough).
This update calls shorten_unambiguous_ref() to do so.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t1506-rev-parse-upstream.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/t/t1506-rev-parse-upstream.sh b/t/t1506-rev-parse-upstream.sh index a2c7f924b..95c9b0923 100755 --- a/t/t1506-rev-parse-upstream.sh +++ b/t/t1506-rev-parse-upstream.sh @@ -76,7 +76,7 @@ test_expect_success 'checkout -b new my-side@{u} forks from the same' ' ) ' -test_expect_failure 'merge my-side@{u} records the correct name' ' +test_expect_success 'merge my-side@{u} records the correct name' ' ( sq="'\''" && cd clone || exit @@ -90,7 +90,7 @@ test_expect_failure 'merge my-side@{u} records the correct name' ' ) ' -test_expect_failure 'branch -d other@{u}' ' +test_expect_success 'branch -d other@{u}' ' git checkout -t -b other master && git branch -d @{u} && git for-each-ref refs/heads/master >actual && @@ -98,7 +98,7 @@ test_expect_failure 'branch -d other@{u}' ' test_cmp expect actual ' -test_expect_failure 'checkout other@{u}' ' +test_expect_success 'checkout other@{u}' ' git branch -f master HEAD && git checkout -t -b another master && git checkout @{u} && |