git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] filter-branch: use printf instead of echo -e
@ 2018-03-19 14:49 Michele Locati
  2018-03-19 15:39 ` CB Bailey
  2018-03-19 15:52 ` [PATCH v2] " Michele Locati
  0 siblings, 2 replies; 10+ messages in thread
From: Michele Locati @ 2018-03-19 14:49 UTC (permalink / raw)
  To: git; +Cc: michele

In order to echo a tab character, it's better to use printf instead of
"echo -e", because it's more portable (for instance, "echo -e" doesn't work
as expected on a Mac).

This solves the "fatal: Not a valid object name" error in git-filter-branch
when using the --state-branch option.

Signed-off-by: Michele Locati <michele@locati.it>
---
 git-filter-branch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 1b7e4b2cd..21d84eff3 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -627,7 +627,7 @@ then
 				print H "$_:$f\n" or die;
 			}
 			close(H) or die;' || die "Unable to save state")
-	state_tree=$(/bin/echo -e "100644 blob $state_blob\tfilter.map" | git mktree)
+	state_tree=$(printf '100644 blob %s\tfilter.map\n' "$state_blob" | git mktree)
 	if test -n "$state_commit"
 	then
 		state_commit=$(/bin/echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-03-23  9:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 14:49 [PATCH] filter-branch: use printf instead of echo -e Michele Locati
2018-03-19 15:39 ` CB Bailey
2018-03-20  4:22   ` Jeff King
2018-03-20  9:53     ` Ian Campbell
2018-03-20 10:21       ` Michele Locati
2018-03-19 15:52 ` [PATCH v2] " Michele Locati
2018-03-19 18:00   ` Junio C Hamano
2018-03-21 21:50   ` Johannes Schindelin
2018-03-22 13:40     ` Michele Locati
2018-03-23  9:35       ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).