summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9f2c13)
raw | patch | inline | side by side (parent: a9f2c13)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Mar 2009 08:20:42 +0000 (01:20 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 11 Mar 2009 05:21:12 +0000 (22:21 -0700) |
An earlier patch always spelled the full name of the ref that we track
(e.g. "refs/heads/frotz" instead of just "frotz" when we mean the branch
whose name is "frotz"). Worse yet, because we now use the true name of
the ref at the original repository when talk about a tracking branch that
copies from a remote, such a full name alone still does not give enough
information.
This reorganizes the verbose codepath to:
- differentiate "refs/heads/something" and everything else; we say that
the branch tracks "branch <something>" if it begins with "refs/heads/",
and otherwise the branch tracks "ref refs/<someother>/<something>";
- report the name of the remote when we talk about a tracking branch, by
saying "branch frotz from origin";
- not say "by merging" at the end; it is the default and is not worth
reporting.
Signed-off-by: Junio C Hamano <junio@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
(e.g. "refs/heads/frotz" instead of just "frotz" when we mean the branch
whose name is "frotz"). Worse yet, because we now use the true name of
the ref at the original repository when talk about a tracking branch that
copies from a remote, such a full name alone still does not give enough
information.
This reorganizes the verbose codepath to:
- differentiate "refs/heads/something" and everything else; we say that
the branch tracks "branch <something>" if it begins with "refs/heads/",
and otherwise the branch tracks "ref refs/<someother>/<something>";
- report the name of the remote when we talk about a tracking branch, by
saying "branch frotz from origin";
- not say "by merging" at the end; it is the default and is not worth
reporting.
Signed-off-by: Junio C Hamano <junio@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c | patch | blob | history |
diff --git a/branch.c b/branch.c
index d20fb0490bc4ea8dc21978596a46f61a625da951..5f889fee6b94d2aa517c1a694b20772b9fa20507 100644 (file)
--- 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);
}