Skip to content

Commit 503359f

Browse files
committed
Merge branch 'mg/branch-set-upstream-previous' into maint
* mg/branch-set-upstream-previous: branch.c: use the parsed branch name
2 parents 40ffc49 + e9d4f74 commit 503359f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void create_branch(const char *head,
210210
start_name);
211211

212212
if (real_ref && track)
213-
setup_tracking(name, real_ref, track);
213+
setup_tracking(ref.buf+11, real_ref, track);
214214

215215
if (!dont_change_ref)
216216
if (write_ref_sha1(lock, sha1, msg) < 0)

t/t6040-tracking-info.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,18 @@ test_expect_success '--set-upstream does not change branch' '
110110
grep -q "^refs/heads/master$" actual &&
111111
cmp expect2 actual2
112112
'
113+
114+
test_expect_success '--set-upstream @{-1}' '
115+
git checkout from-master &&
116+
git checkout from-master2 &&
117+
git config branch.from-master2.merge > expect2 &&
118+
git branch --set-upstream @{-1} follower &&
119+
git config branch.from-master.merge > actual &&
120+
git config branch.from-master2.merge > actual2 &&
121+
git branch --set-upstream from-master follower &&
122+
git config branch.from-master.merge > expect &&
123+
test_cmp expect2 actual2 &&
124+
test_cmp expect actual
125+
'
126+
113127
test_done

0 commit comments

Comments
 (0)