mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michele Locati <>
Cc:, Michele Locati <>
Subject: [PATCH v2] filter-branch: use printf instead of echo -e
Date: Mon, 19 Mar 2018 16:52:59 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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.

Furthermore, let's switch from "/bin/echo" to just "echo", so that the
built-in echo command is used where available.

Signed-off-by: Michele Locati <>
--- | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ b/
index 1b7e4b2cd..98c76ec58 100755
--- a/
+++ b/
@@ -627,12 +627,12 @@ 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\" | git mktree)
+	state_tree=$(printf '100644 blob %s\\n' "$state_blob" | git mktree)
 	if test -n "$state_commit"
-		state_commit=$(/bin/echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
+		state_commit=$(echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
-		state_commit=$(/bin/echo "Sync" | git commit-tree "$state_tree" )
+		state_commit=$(echo "Sync" | git commit-tree "$state_tree" )
 	git update-ref "$state_branch" "$state_commit"

  parent reply	other threads:[~2018-03-19 15:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Michele Locati [this message]
2018-03-19 18:00   ` [PATCH v2] " Junio C Hamano
2018-03-21 21:50   ` Johannes Schindelin
2018-03-22 13:40     ` Michele Locati
2018-03-23  9:35       ` Johannes Schindelin

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:

  List information:

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

  git send-email \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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