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

Re: [PATCH v2] config: add --comment option to add a comment

From
DSDragan Simic <dsimic@manjaro.org>
Date
Mar 12, 2024, 02:25 UTC
Message-ID
<5413ccb588807965c5e54d579db1d741@manjaro.org>
In-Reply-To
<xmqqzfv4pmrn.fsf@gitster.g>
On 2024-03-11 20:54, Junio C Hamano wrote:
Show 19 quoted lines
> Dragan Simic <dsimic@manjaro.org> writes:
> 
>>>> Let me interject...  Perhaps also a tab character before the "#
>>>> comment",
>>>> instead of a space character.  That would result in even better
>>>> readability.
>>> Depends on your screen width ;-)
>> 
>> Ah, screens are pretty wide these days. :)
>> 
>>> If you were trying to tell me that SP or no SP is merely a personal
>>> preference with the comment, I think you succeeded in doing so.
>> 
>> Huh, that wasn't my intention.  IMHO, a space character between "#"
>> and the actual comment is pretty much mandatory.
> 
> Ah, OK, you were talking about the gap after the value before the
> "#" that introduces the comment, but I somehow mistook it as a
> comment about the whitespace after '#'.

Yes, that's what I was talking about. I'm sorry if the way I wrote it initially wasn't clear enough.

> The gap after the value, I do not have a strong opinion either way
> between SP and HT, except that I agree there should be something
> there for readability.

I'd vote for a space character after "#", because that's pretty much the de facto standard. I don't remember seeing tabs used there.

Show 8 quoted lines
> Given that other places where we do insert comments, like in the log
> message editor during "git commit -e", we always give a single space
> after the comment character, I tend to agree that a space after '#'
> is pretty much mandatory.  It is a non starter to tell users that
> they should add their own SP at the beginning if they want to use
> such a common style, i.e.
> 
> 	git commit --comment=' here is my message' ;# BAD

I'd agree with that. Requiring the users to include a leading space would make things inconistent.

Show 10 quoted lines
> With a simple rule like "Unless your message begins with '#', the
> message is prepended by '# ' (pound, followed by a SP), but when
> your message begins with '#', the string is used as is", those who
> want to use their own style can use whatever style they want, e.g.
> 
> 	git commit --comment='#I do not want SP there'
> 	git commit --comment='#^II want a HT there instead'
> 
> and that would be a much more preferrable design, i.e. making the
> common things easy, while leaving unusual things possible.
Agreed.  That would be nice.
Previous: Junio C HamanoNext: Ralph Seichter
Message 20 of 47 in “Allow git-config to append a comment”
  1. Allow git-config to append a commentRalph Seichter via GitGitGadget, Mar 4, 2024
  2. Junio C HamanoMar 6, 2024
  3. Ralph SeichterMar 6, 2024
  4. Junio C HamanoMar 7, 2024
  5. Ralph SeichterMar 7, 2024
  6. Junio C HamanoMar 7, 2024
  7. rsbecker@nexbridge.comMar 7, 2024
  8. Ralph SeichterMar 7, 2024
  9. rsbecker@nexbridge.comMar 7, 2024
  10. Ralph SeichterMar 7, 2024
  11. config: add --comment option to add a commentRalph Seichter via GitGitGadget, Mar 7, 2024
  12. Junio C HamanoMar 11, 2024
  13. Dragan SimicMar 11, 2024
  14. rsbecker@nexbridge.comMar 11, 2024
  15. Dragan SimicMar 11, 2024
  16. Dragan SimicMar 11, 2024
  17. Junio C HamanoMar 11, 2024
  18. Dragan SimicMar 11, 2024
  19. Junio C HamanoMar 11, 2024
  20. Dragan SimicMar 12, 2024
  21. Ralph SeichterMar 11, 2024
  22. Dragan SimicMar 11, 2024
  23. Ralph SeichterMar 11, 2024
  24. Dragan SimicMar 11, 2024
  25. Junio C HamanoMar 11, 2024
  26. Dragan SimicMar 12, 2024
  27. rsbecker@nexbridge.comMar 11, 2024
  28. Dragan SimicMar 12, 2024
  29. Ralph SeichterMar 11, 2024
  30. Dragan SimicMar 11, 2024
  31. Ralph SeichterMar 11, 2024
  32. Ralph SeichterMar 12, 2024
  33. Chris TorekMar 12, 2024
  34. Ralph SeichterMar 12, 2024
  35. Junio C HamanoMar 12, 2024
  36. config: add --comment option to add a commentRalph Seichter via GitGitGadget, Mar 12, 2024
  37. Junio C HamanoMar 15, 2024
  38. 3/1 config: allow tweaking whitespace between value and commentJunio C Hamano, Mar 15, 2024
  39. Junio C HamanoMar 26, 2024
  40. Ralph SeichterMar 26, 2024
  41. Junio C HamanoMar 26, 2024
  42. Ralph SeichterMar 27, 2024
  43. Dragan SimicMar 27, 2024
  44. Junio C HamanoMar 27, 2024
  45. Eric SunshineMar 15, 2024
  46. Junio C HamanoMar 15, 2024
  47. Junio C HamanoMar 15, 2024

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.