summaryrefslogtreecommitdiff
path: root/src/branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/branch.c')
-rw-r--r--src/branch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/branch.c b/src/branch.c
index ab661f422..830294941 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -521,7 +521,8 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
goto on_error;
if (local) {
- if (git_buf_puts(&value, git_reference_name(branch)) < 0)
+ git_buf_clear(&value);
+ if (git_buf_puts(&value, git_reference_name(upstream)) < 0)
goto on_error;
} else {
/* Get the remoe-tracking branch's refname in its repo */