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

Re: [PATCH] wt-status.c: Modified status message shown for a parent-less branch

From
Jeff King <peff@peff.net>
Date
Jun 12, 2017, 21:20 UTC
Message-ID
<20170612212025.ytyukvmmthfcsejh@sigill.intra.peff.net>
In-Reply-To
<xmqqa85dnjpz.fsf@gitster.mtv.corp.google.com>
On Mon, Jun 12, 2017 at 11:28:56AM -0700, Junio C Hamano wrote:
Show 19 quoted lines
> Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:
> 
> >> Adding a bit to "struct wt_status" is a good first step to allow all
> >> three (i.e. in addition to "Initial commit" and "Changes to be
> >> committed", "Changes not staged for commit" is the other one that
> >> shares this potential confusion factor) to be phrased in a way that
> >> is more appropriate in an answer to the question "what is the status
> >> of my working area?", I would think.
> >> 
> >> Thanks.
> >> 
> > It seems that the current change has to be discarded altogether and
> > further the change required doesn't look trivial. This seems to warrant
> > some bit of research of the code base. As a first step I would like to
> > know which part of the code base creates the commit template. I guess
> > much can't be done without knowing how it's created.
> 
> Perhaps something along this line (warning: not even compile
> tested)?

So I think the addition of the bit here is obviously correct, and I'm not opposed to the idea of giving wt-status more information so that it can make better messages. But I'm not sure it's actually helping for some of these cases. E.g.:

Show 5 quoted lines
> -	status_printf_ln(s, c, _("Changes not staged for commit:"));
> +	if (s->commit_template)
> +		status_printf_ln(s, c, _("Changes not staged for commit:"));
> +	else
> +		status_printf_ln(s, c, _("Changes not yet in the index:"));

I think "staged for commit" still makes perfect sense even when we are just asking "what's the current status" and not "what would it look like if I were to commit".

And avoiding the word "index" is worth-while here, I think. I am not in general of the "let's hide the index" camp" but it is a technical term. If we can say the same thing in a way that is understood both by people who know what the index is and people who do not, that seems like a win.

Show 5 quoted lines
> -	status_printf_ln(s, c, _("Changes to be committed:"));
> +	if (s->commit_template)
> +		status_printf_ln(s, c, _("Changes to be committed:"));
> +	else
> +		status_printf_ln(s, c, _("Changes already in the index:"));

This one is less obvious, because "to be committed" more strongly implies making an actual commit. At the same time, I don't think it's unclear what it means in the context of status. It could be "Changes staged for commit" to match the other "not staged" message, though I think I prefer the existing wording.

Show 9 quoted lines
> @@ -1578,7 +1584,10 @@ static void wt_longstatus_print(struct wt_status *s)
>  
>  	if (s->is_initial) {
>  		status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
> -		status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit"));
> +		status_printf_ln(s, color(WT_STATUS_HEADER, s),
> +				 s->commit_template
> +				 ? _("Initial commit")
> +				 : _("No commit yet on the branch"));
This one I think is an improvement. :)
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 48 in “wt-status.c: Modified status message shown for a parent-less branch”
  1. wt-status.c: Modified status message shown for a parent-less branchKaartic Sivaraam, Jun 10, 2017
  2. Kaartic SivaraamJun 10, 2017
  3. Junio C HamanoJun 10, 2017
  4. Kaartic SivaraamJun 10, 2017
  5. Kaartic SivaraamJun 10, 2017
  6. Jeff KingJun 10, 2017
  7. Junio C HamanoJun 10, 2017
  8. Kaartic SivaraamJun 12, 2017
  9. Junio C HamanoJun 12, 2017
  10. Jeff KingJun 12, 2017
  11. Junio C HamanoJun 12, 2017
  12. Jeff KingJun 12, 2017
  13. Kaartic SivaraamJun 15, 2017
  14. Jeff KingJun 15, 2017
  15. Samuel LijinJun 15, 2017
  16. Jeff KingJun 15, 2017
  17. Kaartic SivaraamJun 16, 2017
  18. Jeff KingJun 16, 2017
  19. Kaartic SivaraamJun 18, 2017
  20. Contextually notify user about an initial commitKaartic Sivaraam, Jun 18, 2017
  21. Ævar Arnfjörð BjarmasonJun 18, 2017
  22. 1/2 Contextually notify user about an initial commitKaartic Sivaraam, Jun 19, 2017
  23. 2/2 Add test for the new status messageKaartic Sivaraam, Jun 19, 2017
  24. Junio C HamanoJun 19, 2017
  25. Kaartic SivaraamJun 19, 2017
  26. Jeff KingJun 19, 2017
  27. Kaartic SivaraamJun 19, 2017
  28. Junio C HamanoJun 19, 2017
  29. 2/2 Add test for the new status messageKaartic Sivaraam, Jun 19, 2017
  30. Jeff KingJun 19, 2017
  31. Kaartic SivaraamJun 19, 2017
  32. Junio C HamanoJun 19, 2017
  33. 1/3 Contextually notify user about an initial commitKaartic Sivaraam, Jun 20, 2017
  34. 2/3 Update test(s) that used old status messageKaartic Sivaraam, Jun 20, 2017
  35. 3/3 Add tests for the contextual initial status messageKaartic Sivaraam, Jun 20, 2017
  36. Ævar Arnfjörð BjarmasonJun 20, 2017
  37. Kaartic SivaraamJun 20, 2017
  38. Ævar Arnfjörð BjarmasonJun 20, 2017
  39. Kaartic SivaraamJun 21, 2017
  40. status: contextually notify user about an initial commitKaartic Sivaraam, Jun 21, 2017
  41. Kaartic SivaraamJun 21, 2017
  42. Ævar Arnfjörð BjarmasonJun 21, 2017
  43. Kaartic SivaraamJun 21, 2017
  44. Junio C HamanoJun 21, 2017
  45. status: contextually notify user about an initial commitKaartic Sivaraam, Jun 21, 2017
  46. Junio C HamanoJun 22, 2017
  47. Kaartic SivaraamJun 22, 2017
  48. Philip OakleyJun 10, 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.