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

Re: [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split"

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2009, 06:53 UTC
Message-ID
<7vfxhhj4mh.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200903130702.01039.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> Aren't gets and fgets an example that having the choice to strip out the 
> delimiter or not is good?

I consider it is an example that an earlier simplistic API (gets()) later gets corrected when it is redone right (fgets()) with other changes like a proper bounds check.

Show 5 quoted lines
>> A more general 
>> solution should be by default not to strip it, and I do not think your
>> new caller, if it were written correctly, needs stripping behaviour
>> either. That means there is no need for the "optionally strip" flag to
>> the function in order to support the rest of the series [*2*].

I also do not agree that you have to keep list of skip both in shell and rev-list when you go the route I suggested. I think a separate bisect.c you did is a good first step to make not just the bisect machinery but the whole bisect command into a built-in, and even if we do not do the full rewrite in C in one go, moving these "shell script reads from refs/bisect only to feed the result to rev-list --bisect" pattern to "shell script updates refs/bisect and let rev-list --bisect read from there" pattern would be a good initial step. Oh, and I did not mean it only for "skip", but also doing this for "good" and "bad" as well.

For example, you read "refs/bisect/skip-*" and keep that in $skip to:
 - feed it to filter_skipped() which you are making built-in with this
   series;
 - feed it to check_good_are_ancestors_of_bad that in turn calls
   check_merge_bases;

and its use is contained in bisect_next() alone. After this series is done, we can move the logic in check_good_are... to bisect.c and you do not have to read refs/bisect/skip-* in the shell anymore. IOW, we can migrate away from the "shell reads from refs/bisect/ and feeds that to rev-list --bisect" pattern incrementally.

Previous: Christian CouderNext: Christian Couder
Message 5 of 9 in “strbuf: add "include_delim" parameter to "strbuf_split"”
  1. 1/7 strbuf: add "include_delim" parameter to "strbuf_split"Christian Couder, Mar 12, 2009
  2. Christian CouderMar 13, 2009
  3. Junio C HamanoMar 13, 2009
  4. Christian CouderMar 13, 2009
  5. Junio C HamanoMar 13, 2009
  6. Migrate bisect to C (was: [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split")Christian Couder, Mar 14, 2009
  7. Junio C HamanoMar 14, 2009
  8. fetch--tool, was Re: Migrate bisect to CJohannes Schindelin, Mar 14, 2009
  9. Junio C HamanoMar 13, 2009

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.