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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2024, 23:41 UTC
Message-ID
<xmqqttl7njv2.fsf@gitster.g>
In-Reply-To
<CAPig+cQwWu=FA4vnKK9+aLkTzAzMXp6h5aJedEh3FT+1bNTjAQ@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 8 quoted lines
> tackled by this patch. Do we foresee a future in which git-config may
> be extended to handle automation of comments other than inline? If so,
> do we really want to lock ourselves into having the generic option
> `--comment=<message>` be restricted to only inline comments? Or would
> it be better to plan for the future by instead having some sort of
> annotation which indicates that we are requesting (or dealing with)
> only inline comments, such as `--inline-comment=<message>` or
> `--comment=inline:<message>`?

I do not see a need for anything, while we fail a request with a multi-line message and say "don't feed me a multi-line message".

When we start supporting multi-line comment (which I do not think is a good idea at all, by the way), the code can switch between

	[vari]
		able = value # single line comment
		# a comment with
		# more than one line
		able = value

depending on what is in <message>, so "inline:" prefix does not even have to exist, I would imagine. Of course you could even go fancier and allow something like this with unnecessary tailing LF ...

	$ git config --comment='another single line comment
	'
... as a signal to turn a single line commet on a separate line.
	[vari]
		able = value # single line comment
		# a comment with
		# more than one line
		able = value
		# another single value comment
		able = value

There will most likely need where e.g., above or below, around the "var = val" line to place the comment as well, so I do not see much value in investing more brain cycles on what the "--comment" option should look like, while we only support single-liners and explicitly reject multi-line messages.

Previous: Eric SunshineNext: Junio C Hamano
Message 46 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.