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

Re: [PATCH] bisect: fix replay of CRLF logs

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2020, 15:07 UTC
Message-ID
<xmqqh7wq1n52.fsf@gitster.c.googlers.com>
In-Reply-To
<20200508130831.GB631018@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> On Thu, May 07, 2020 at 04:07:54PM -0700, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>> 
>> > The simplest fix is probably to clean up "$file" into another tempfile,
>> > and then read from that.
>> 
>> Or just tell the users do not break the log file (or they can keep
>> both halves)?
>
> I am OK with that, too. :)
Well, that was tongue-in-cheek.

The log is designed to be edited and then run via the shell or fed to the "bisect replay" subcommand, so if a (wide) class of editors tend to "corrupt" the edited result in a known and recoverable way, we should deal with it.

Replaying is just setting the refs the logged session should have known about (without checking out the revisions at each step) and doing the final checkout, so it should be a fast operation, and penalizing majority of users by paying the cost to dos2unix copy the file "just in case" feels somewhat ugly. I wish we were dumb and checked out each and every intermediate steps---then the cost for such a "just in case" clean-up would have been dwarfed in the noise.

I wonder if we can add a CR to IFS so that the parsing logic of each line would not even see it?

 bisect_replay () {
         file="$1"
         test "$#" -eq 1 || die "$(gettext "No logfile given")"
         test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
         git bisect--helper --bisect-reset || exit
+        IFS="$IFS$(printf "\015")"
         while read git bisect command rev
         do
                 test "$git $bisect" = "git bisect" ||
                 test "$git" = "git-bisect" || continue
Previous: Jeff KingNext: Junio C Hamano
Message 6 of 13 in “bisect: fix replay of CRLF logs”
  1. bisect: fix replay of CRLF logsChristopher Warrington via GitGitGadget, May 7, 2020
  2. Eric SunshineMay 7, 2020
  3. Jeff KingMay 7, 2020
  4. Junio C HamanoMay 7, 2020
  5. Jeff KingMay 8, 2020
  6. Junio C HamanoMay 8, 2020
  7. Junio C HamanoMay 8, 2020
  8. Jeff KingMay 8, 2020
  9. Junio C HamanoMay 8, 2020
  10. brian m. carlsonMay 9, 2020
  11. Achim GratzMay 10, 2020
  12. Christopher Warrington (CHRISTOPHER)May 8, 2020
  13. Junio C HamanoMay 9, 2020

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.