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

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

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
May 20, 2020, 03:44 UTC
Message-ID
<20200520034444.47932-3-carenas@gmail.com>
In-Reply-To
<20200520034444.47932-1-carenas@gmail.com>

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 <carenas@gmail.com>
---
 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 11 in “openbsd: fixes for 2.27.0-RC0”
  1. 0/3 openbsd: fixes for 2.27.0-RC0Carlo Marcelo Arenas Belón, May 20, 2020
  2. 1/3 t4216: avoid unnecessary subshell in test_bloom_filters_not_usedCarlo Marcelo Arenas Belón, May 20, 2020
  3. Junio C HamanoMay 20, 2020
  4. 2/3 bisect: remove CR characters from revision in replayCarlo Marcelo Arenas Belón, May 20, 2020
  5. Junio C HamanoMay 20, 2020
  6. Carlo Marcelo Arenas BelónMay 20, 2020
  7. Junio C HamanoMay 20, 2020
  8. Christopher Warrington (CHRISTOPHER)May 20, 2020
  9. Junio C HamanoMay 20, 2020
  10. 3/3 t5520: avoid alternation in grep's BRE (not POSIX)Carlo Marcelo Arenas Belón, May 20, 2020
  11. Junio C HamanoMay 20, 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.