All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christopher Warrington via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,
	Christopher Warrington <chwarr@microsoft.com>
Subject: Re: [PATCH] bisect: fix replay of CRLF logs
Date: Fri, 8 May 2020 13:12:32 -0400	[thread overview]
Message-ID: <20200508171232.GA637136@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqq8si2z8zb.fsf@gitster.c.googlers.com>

On Fri, May 08, 2020 at 09:28:56AM -0700, Junio C Hamano wrote:

> -- >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.

> 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

  reply	other threads:[~2020-05-08 17:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 21:29 [PATCH] bisect: fix replay of CRLF logs Christopher Warrington via GitGitGadget
2020-05-07 22:13 ` Eric Sunshine
2020-05-07 22:25 ` Jeff King
2020-05-07 23:07   ` Junio C Hamano
2020-05-08 13:08     ` Jeff King
2020-05-08 15:07       ` Junio C Hamano
2020-05-08 16:28         ` Junio C Hamano
2020-05-08 17:12           ` Jeff King [this message]
2020-05-08 17:53             ` Junio C Hamano
2020-05-09 22:17             ` brian m. carlson
2020-05-10 10:54               ` Achim Gratz
2020-05-08 22:59           ` [EXTERNAL] " Christopher Warrington (CHRISTOPHER)
2020-05-09 16:28             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508171232.GA637136@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=chwarr@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.