Subject: [PATCH 2/3] bisect: remove CR characters from revision in replay

From: Carlo Marcelo Arenas Belón <[email-masked]>
Date: Tue, 19 May 2020 20:44:43 -0700

6c722cbe5a (bisect: allow CRLF line endings in "git bisect replay"
input, 2020-05-07) includes CR as a field separator, but doesn't
account for it being included in the last field, breaking when
running at least under OpenBSD 6.7's sh.

Read the revision into a raw variable and strip it of any possible
embeded CR characters, before use.

Signed-off-by: Carlo Marcelo Arenas Belón <[email-masked]>
---
 git-bisect.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 71b367a944..8cd6095a71 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -210,14 +210,15 @@ bisect_replay () {
 	test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
 	git bisect--helper --bisect-reset || exit
 	oIFS="$IFS" IFS="$IFS$(printf '\015')"
-	while read git bisect command rev
+	while read git bisect command rawrev
 	do
 		test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue
 		if test "$git" = "git-bisect"
 		then
-			rev="$command"
+			rawrev="$command"
 			command="$bisect"
 		fi
+		rev=$(echo $rawrev | tr -d '\015')
 		get_terms
 		git bisect--helper --check-and-set-terms "$command" "$TERM_GOOD" "$TERM_BAD" || exit
 		get_terms
-- 
2.27.0.rc0.187.gede8c892b8