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

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

From
Jeff King <peff@peff.net>
Date
May 8, 2020, 17:12 UTC
Message-ID
<20200508171232.GA637136@coredump.intra.peff.net>
In-Reply-To
<xmqq8si2z8zb.fsf@gitster.c.googlers.com>
On Fri, May 08, 2020 at 09:28:56AM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> -- >8 --
> From: Christopher Warrington <chwarr@microsoft.com>
> Subject: [PATCH] bisect: allow CRLF line endings in "git bisect replay" input
> 
> We advertise that the bisect log can be corrected in your editor
> before being fed to "git bisect replay", but some editors may
> turn the line endings to CRLF.
> 
> Update the parser of the input lines so that the CR at the end of
> the line gets ignored.

I'm a little surprised that bash "read" on Windows doesn't eat CRLFs already. But I often find myself confused by line ending decisions in general, as well as the difference between cygwin versus msys versus pure windows binaries, etc.

At any rate, munging IFS seems much nicer than having an extra call to tr.

Show 9 quoted lines
> diff --git a/git-bisect.sh b/git-bisect.sh
> index efee12b8b1..56548d4be7 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -209,6 +209,7 @@ bisect_replay () {
>  	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
> +	oIFS="$IFS" IFS="$IFS:$(printf '\015')"

There's no ":" separator in IFS, so here you're treating colon as end-of-line. I think you just want:

  IFS="$IFS$(printf '\015')"
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 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.