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

[PATCH 2/2] git-rebase--interactive.sh: use printf instead of echo to print commit message

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Aug 13, 2010, 20:47 UTC
Message-ID
<vFgTzGXLhalxcMpLoOFhqi1W6sU5I3lJ9CWjrrJjoRmkMjHSswmpLXU2vVL8PS5JJNEO727l9q8@cipher.nrlssc.navy.mil>
In-Reply-To
<D1A252AE-5D4C-4E51-9359-F4A443BB8A2E@silverinsanity.com>
From: Brandon Casey <drafnel@gmail.com>

Replace the echo statements that operate on $rest with printf's to restore what was lost from 938791cd. This avoids any mangling that XSI-conformant echo's may introduce.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Junio,
Feel free to squash this into 1/2 if desired.
-Brandon
 git-rebase--interactive.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 2e5bed0..3419247 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -625,7 +625,7 @@ skip_unnecessary_picks () {
 		case "$fd,$command" in
 		3,pick|3,p)
 			# pick a commit whose parent is current $ONTO -> skip
-			sha1=$(echo "$rest" | cut -d ' ' -f 1)
+			sha1=$(printf '%s' "$rest" | cut -d ' ' -f 1)
 			case "$(git rev-parse --verify --quiet "$sha1"^)" in
 			"$ONTO"*)
 				ONTO=$sha1
@@ -642,7 +642,7 @@ skip_unnecessary_picks () {
 			fd=1
 			;;
 		esac
-		echo "$command${rest:+ }$rest" >&$fd
+		printf '%s\n' "$command${rest:+ }$rest" >&$fd
 	done <"$TODO" >"$TODO.new" 3>>"$DONE" &&
 	mv -f "$TODO".new "$TODO" &&
 	case "$(peek_next_command)" in
-- 
1.7.2.1
Previous: Brandon CaseyNext: Brian Gernhardt
Message 4 of 7 in “git rebase -i exec merger broke t3404-rebase-interactive.sh”
  1. Ævar Arnfjörð BjarmasonAug 13, 2010
  2. Brian GernhardtAug 13, 2010
  3. 1/2 git-rebase--interactive.sh: rework skip_unnecessary_picksBrandon Casey, Aug 13, 2010
  4. 2/2 git-rebase--interactive.sh: use printf instead of echo to print commit messageBrandon Casey, Aug 13, 2010
  5. Brian GernhardtAug 13, 2010
  6. Matthieu MoyAug 15, 2010
  7. Junio C HamanoAug 22, 2010

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.