Thread (1 message) 1 message, 1 author, 2020-05-08

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

From: Junio C Hamano <hidden>
Date: 2020-05-08 15:07:13

Jeff King [off-list ref] writes:
On Thu, May 07, 2020 at 04:07:54PM -0700, Junio C Hamano wrote:
quoted
Jeff King [off-list ref] writes:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help