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

Re: [RFC PATCH 1/3] strbuf: make add_lines() public

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 30, 2023, 23:53 UTC
Message-ID
<xmqqy1fj8y5m.fsf@gitster.g>
In-Reply-To
<d96633a2919ac619ccf29e87abc6f25314a8bfb1.1698696798.git.jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
> Subsequent patches will require the ability to add different prefixes
> to different lines (depending on their contents), so make this
> functionality available from outside strbuf.c.

I do not think it is a good idea to force almost everybody to repeat themselves. As we can see here, all but just a single caller of strbuf_add_lines() with this patch pass the same prefix for both parameters. If we need to make the current strbuf.c:add_lines() also available to some specific callers, that is fine, but let's keep the simpler version that almost everybody uses as-is, and give the more complex and featureful one that is used only by selected callers a longer and more cumbersome name.

Thanks.
Previous: Jonathan TanNext: Junio C Hamano
Message 8 of 21 in “Avoid passing global comment_line_char repeatedly”
  1. 0/2 Avoid passing global comment_line_char repeatedlyJunio C Hamano, Oct 30, 2023
  2. 1/2 strbuf_commented_addf(): drop the comment_line_char parameterJunio C Hamano, Oct 30, 2023
  3. 2/2 strbuf_add_commented_lines(): drop the comment_line_char parameterJunio C Hamano, Oct 30, 2023
  4. Dragan SimicOct 30, 2023
  5. Phillip WoodOct 30, 2023
  6. 0/3 Avoid passing global comment_line_char repeatedlyJonathan Tan, Oct 30, 2023
  7. 1/3 strbuf: make add_lines() publicJonathan Tan, Oct 30, 2023
  8. Junio C HamanoOct 30, 2023
  9. Junio C HamanoOct 31, 2023
  10. 2/3 strbuf_commented_addf(): drop the comment_line_char parameterJonathan Tan, Oct 30, 2023
  11. Junio C HamanoOct 31, 2023
  12. Jonathan TanOct 31, 2023
  13. Junio C HamanoOct 31, 2023
  14. 3/3 strbuf_add_commented_lines(): drop the comment_line_char parameterJonathan Tan, Oct 30, 2023
  15. 0/4 Avoid passing global comment_line_char repeatedlyJonathan Tan, Oct 31, 2023
  16. 1/4 strbuf_commented_addf(): drop the comment_line_char parameterJonathan Tan, Oct 31, 2023
  17. 2/4 strbuf_add_commented_lines(): drop the comment_line_char parameterJonathan Tan, Oct 31, 2023
  18. 3/4 strbuf: make add_lines() publicJonathan Tan, Oct 31, 2023
  19. Junio C HamanoNov 1, 2023
  20. 4/4 strbuf: move env-using functions to environment.cJonathan Tan, Oct 31, 2023
  21. Junio C HamanoNov 1, 2023

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.