Commit 206a6ae0 authored by Michele Locati's avatar Michele Locati Committed by Junio C Hamano

filter-branch: use printf instead of echo -e

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's avatarMichele Locati <michele@locati.it>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 3013dff8
......@@ -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\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")
state_commit=$(echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
else
state_commit=$(/bin/echo "Sync" | git commit-tree "$state_tree" )
state_commit=$(echo "Sync" | git commit-tree "$state_tree" )
fi
git update-ref "$state_branch" "$state_commit"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment