summaryrefslogtreecommitdiff
path: root/branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/branch.c b/branch.c
index d20fb0490b..5f889fee6b 100644
--- a/branch.c
+++ b/branch.c
@@ -65,12 +65,23 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
git_config_set(key.buf, "true");
}
- if (flag & BRANCH_CONFIG_VERBOSE)
- printf("Branch %s set up to track %s branch %s %s.\n",
- local,
- origin ? "remote" : "local",
- remote,
- rebasing ? "by rebasing" : "by merging");
+ if (flag & BRANCH_CONFIG_VERBOSE) {
+ strbuf_reset(&key);
+
+ strbuf_addstr(&key, origin ? "remote" : "local");
+
+ /* Are we tracking a proper "branch"? */
+ if (!prefixcmp(remote, "refs/heads/")) {
+ strbuf_addf(&key, " branch %s", remote + 11);
+ if (origin)
+ strbuf_addf(&key, " from %s", origin);
+ }
+ else
+ strbuf_addf(&key, " ref %s", remote);
+ printf("Branch %s set up to track %s%s.\n",
+ local, key.buf,
+ rebasing ? " by rebasing" : "");
+ }
strbuf_release(&key);
}