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

Re: [PATCH 0/1] Add stash entry count summary to short status output

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 24, 2017, 20:07 UTC
Message-ID
<xmqqshggvien.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<c3ac0335-4f41-40d9-00ee-2a4e115bcf7a@gmail.com>
Sonny Michaud <michaud.sonny@gmail.com> writes:
Show 13 quoted lines
> diff --git a/wt-status.c b/wt-status.c                                         
> index 77c27c511..651bb01f0 100644                                              
> --- a/wt-status.c                                                              
> +++ b/wt-status.c                                                              
> @@ -1827,6 +1827,15 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)                                                                          
>         fputc(s->null_termination ? '\0' : '\n', s->fp);                       
>  }                                                                             
>                                                                                
> +static void wt_shortstatus_print_stash_summary(struct wt_status *s)           
> +{                                                                             
> +       int stash_count = 0;                                                   
> +                                                                              
> +       for_each_reflog_ent("refs/stash", stash_count_refs, &stash_count);     

A singleton instance of this in wt_longstatus_print_stash_summary() thing was OK, but let's not duplicate and spread the badness. Have a simple there-liner helper function "static int stash_count(void);" that does the above and returns the stash_count, and use it from both places.

> +       if (stash_count > 0)                                                   
> +    color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "## Stash entries: %d", stash_count);                                                                    
That's a funny way to indent (dedent?) a body of an if() statement.

Don't scripts that read this output (I notice that this is also called by wt_porcelain_print() function) expect that entries that are led by "##" are about the current branch and its tracking information?

This patch would break these script by adding this new line using the same "##" leader.

Previous: Junio C HamanoNext: Sonny Michaud
Message 5 of 7 in “Add stash entry count summary to short status output”
  1. 0/1 Add stash entry count summary to short status outputSonny Michaud, Aug 20, 2017
  2. Sonny MichaudAug 22, 2017
  3. Sonny MichaudAug 24, 2017
  4. Junio C HamanoAug 24, 2017
  5. Junio C HamanoAug 24, 2017
  6. Sonny MichaudAug 31, 2017
  7. Jonathan NiederSep 1, 2017

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.