Re: [PATCH] Reformat "your branch has diverged..." lines to reduce line length.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 16, 2008, 19:48 UTC
- Message-ID
- <7v4p6pr4ob.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1216235967-9510-1-git-send-email-apenwarr@gmail.com>
Avery Pennarun <apenwarr@gmail.com> writes:
> 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",
I wonder if a simple "s/of the tracked%s branch //" is better for this kind of thing. If the message says 'origin/master', you know it is a tracked remote branch anyway, don't you?
Too wide is bad, but too tall is worse. Some of us still work in 80x24 ;-) and I prefer to make the message succinct when possible, rather than keeping it long and spread over multiple lines.
Show 6 quoted lines
> 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",
This does not make the message taller, but if we were to make the "only one side advanced" cases shorter, we would need to reword this to be consistent. Perhaps something like this would be just as easy to read and more compact?
Your branch is ahead of 'origin/add-chickens2' by 21 commits.
Your branch is behind 'origin/add-chickens2' by 1 commit.
Your branch and 'origin/add-chickens2' have diverged, and have
21 and 1 different commit(s) each, respectively.I moved "respectively" so that the variable parts will come close to the beginning of physical line.