summaryrefslogtreecommitdiff
path: root/git-filter-branch.sh
diff options
context:
space:
mode:
authorMichele Locati <michele@locati.it>2018-03-19 15:52:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-19 17:59:28 (GMT)
commit206a6ae01355e4d5d0e01e6d99d960fcc907e6b3 (patch)
tree82e6c4bd0185241b665395b76c88c7934b81eb3f /git-filter-branch.sh
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-206a6ae01355e4d5d0e01e6d99d960fcc907e6b3.zip
git-206a6ae01355e4d5d0e01e6d99d960fcc907e6b3.tar.gz
git-206a6ae01355e4d5d0e01e6d99d960fcc907e6b3.tar.bz2
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 <michele@locati.it> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-filter-branch.sh')
-rwxr-xr-xgit-filter-branch.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 1b7e4b2..98c76ec 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -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