git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/5] branch: show upstream branch when double verbose

From
Wincent Colaiuta <win@wincent.com>
Date
Apr 13, 2009, 17:04 UTC
Message-ID
<18CF07A6-68CB-4A17-ACC9-89CD8545F58B@wincent.com>
In-Reply-To
<20090413083413.GB9846@coredump.intra.peff.net>
El 13/4/2009, a las 10:34, Jeff King escribió:
Show 32 quoted lines
> On Thu, Apr 09, 2009 at 12:15:08PM +0200, Santi Béjar wrote:
>
>> I've been thinking about this and both formats seems OK for me,
>> although using the +5 -6 format for just -v seems a good point.
>
> The trivial patch for this is below:
>
> ---
> diff --git a/builtin-branch.c b/builtin-branch.c
> index 3275821..c056a4d 100644
> --- a/builtin-branch.c
> +++ b/builtin-branch.c
> @@ -317,14 +317,14 @@ static void fill_tracking_info(struct strbuf  
> *stat, const char *branch_name,
>
> 	strbuf_addch(stat, '[');
> 	if (show_upstream_ref)
> -		strbuf_addf(stat, "%s: ",
> +		strbuf_addf(stat, "%s ",
> 			shorten_unambiguous_ref(branch->merge[0]->dst));
> 	if (!ours)
> -		strbuf_addf(stat, "behind %d] ", theirs);
> +		strbuf_addf(stat, "-%d] ", theirs);
> 	else if (!theirs)
> -		strbuf_addf(stat, "ahead %d] ", ours);
> +		strbuf_addf(stat, "+%d] ", ours);
> 	else
> -		strbuf_addf(stat, "ahead %d, behind %d] ", ours, theirs);
> +		strbuf_addf(stat, "+%d -%d] ", ours, theirs);
> }
>
> static int matches_merge_filter(struct commit *commit)

I'm skeptical that people will know at a glance that "-" and "+" in this context map onto "behind" and "ahead". I think that trading off the clarity and obviousness of the words "behind" and "ahead" for the brevity of the symbols "-" and "+" wouldn't be a very good idea.

Cheers, Wincent

Previous: Jeff KingNext: Paolo Ciarrocchi
Message 18 of 24 in “making upstream branch information accessible”
  1. 0/5 making upstream branch information accessibleJeff King, Apr 7, 2009
  2. 1/5 for-each-ref: refactor get_short_ref functionJeff King, Apr 7, 2009
  3. 2/5 for-each-ref: refactor refname handlingJeff King, Apr 7, 2009
  4. Junio C HamanoApr 8, 2009
  5. Jeff KingApr 8, 2009
  6. 3/5 for-each-ref: add "upstream" format fieldJeff King, Apr 7, 2009
  7. 4/5 make get_short_ref a public functionJeff King, Apr 7, 2009
  8. Bert WesargApr 7, 2009
  9. Jeff KingApr 9, 2009
  10. Bert WesargApr 9, 2009
  11. Jeff KingApr 13, 2009
  12. Michael J GruberApr 7, 2009
  13. 5/5 branch: show upstream branch when double verboseJeff King, Apr 7, 2009
  14. Michael J GruberApr 7, 2009
  15. Jeff KingApr 9, 2009
  16. Santi BéjarApr 9, 2009
  17. Jeff KingApr 13, 2009
  18. Wincent ColaiutaApr 13, 2009
  19. Paolo CiarrocchiApr 7, 2009
  20. for-each-ref: remove multiple xstrdup() in get_short_ref()Bert Wesarg, Apr 7, 2009
  21. Jeff KingApr 7, 2009
  22. Bert WesargApr 7, 2009
  23. Jeff KingApr 7, 2009
  24. Bert WesargApr 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.