From: Avery Pennarun <apenwarr@gmail.com>
To: gitster@pobox.com, git@vger.kernel.org
Cc: Avery Pennarun <apenwarr@gmail.com>
Subject: [PATCH] Reformat "your branch has diverged..." lines to reduce line length.
Date: Wed, 16 Jul 2008 15:19:27 -0400 [thread overview]
Message-ID: <1216235967-9510-1-git-send-email-apenwarr@gmail.com> (raw)
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 puts the newlines in slightly different places to reduce the
probability of this happening. Now you'd need a significantly longer
branch name to trigger the problem.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
---
remote.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
I suppose a full-on automatic wordwrapper would be nicer :)
diff --git a/remote.c b/remote.c
index df8bd72..4f32032 100644
--- a/remote.c
+++ b/remote.c
@@ -1321,19 +1321,19 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
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 the tracked%s branch '%s'\n"
"by %d commit%s.\n",
remote_msg, 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 the tracked%s branch '%s'\n"
+ "by %d commit%s, "
"and can be fast-forwarded.\n",
remote_msg, base,
num_theirs, (num_theirs == 1) ? "" : "s");
else
- strbuf_addf(sb, "Your branch and the tracked%s branch '%s' "
- "have diverged,\nand respectively "
+ strbuf_addf(sb, "Your branch and the tracked%s branch '%s'\n"
+ "have diverged, and respectively "
"have %d and %d different commit(s) each.\n",
remote_msg, base,
num_ours, num_theirs);
--
1.5.6.3.385.g94745
next reply other threads:[~2008-07-16 19:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 19:19 Avery Pennarun [this message]
2008-07-16 19:48 ` [PATCH] Reformat "your branch has diverged..." lines to reduce line length Junio C Hamano
2008-07-16 20:27 ` Avery Pennarun
2008-07-16 22:03 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1216235967-9510-1-git-send-email-apenwarr@gmail.com \
--to=apenwarr@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).