summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2008-07-16 15:19:27 -0400
committerJunio C Hamano <gitster@pobox.com>2008-07-16 17:56:59 -0700
commit4de53ce0437e7326908c4a0571ac4ff9b8d5aeff (patch)
treeab31d2bcbeb8445a49ae99375d5cfb518f8744e8 /remote.c
parentfcab40a389e99786a8276108cdbc1cda8caf502f (diff)
downloadgit-4de53ce0437e7326908c4a0571ac4ff9b8d5aeff.tar.gz
Reword "your branch has diverged..." lines to reduce line length
The message length depends on the length of the branch name. In my case, the branch name "origin/add-chickens2" put the first line of the "your branch has diverged" message over 80 characters, which triggered "less -FS" to not exit automatically as expected. This patch rewords the messages to make the lines generally shorter, so that you'd need a significantly longer branch name to trigger the problem. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/remote.c b/remote.c
index df8bd72ba9..0d6020beb8 100644
--- a/remote.c
+++ b/remote.c
@@ -1308,34 +1308,28 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
int format_tracking_info(struct branch *branch, struct strbuf *sb)
{
int num_ours, num_theirs;
- const char *base, *remote_msg;
+ const char *base;
if (!stat_tracking_info(branch, &num_ours, &num_theirs))
return 0;
base = branch->merge[0]->dst;
if (!prefixcmp(base, "refs/remotes/")) {
- remote_msg = " remote";
base += strlen("refs/remotes/");
- } else {
- remote_msg = "";
}
if (!num_theirs)
- strbuf_addf(sb, "Your branch is ahead of the tracked%s branch '%s' "
+ strbuf_addf(sb, "Your branch is ahead of '%s' "
"by %d commit%s.\n",
- remote_msg, base,
- num_ours, (num_ours == 1) ? "" : "s");
+ base, num_ours, (num_ours == 1) ? "" : "s");
else if (!num_ours)
- strbuf_addf(sb, "Your branch is behind the tracked%s branch '%s' "
- "by %d commit%s,\n"
+ strbuf_addf(sb, "Your branch is behind '%s' "
+ "by %d commit%s, "
"and can be fast-forwarded.\n",
- remote_msg, base,
- num_theirs, (num_theirs == 1) ? "" : "s");
+ base, num_theirs, (num_theirs == 1) ? "" : "s");
else
- strbuf_addf(sb, "Your branch and the tracked%s branch '%s' "
- "have diverged,\nand respectively "
- "have %d and %d different commit(s) each.\n",
- remote_msg, base,
- num_ours, num_theirs);
+ strbuf_addf(sb, "Your branch and '%s' have diverged,\n"
+ "and have %d and %d different commit(s) each, "
+ "respectively.\n",
+ base, num_ours, num_theirs);
return 1;
}