From: Junio C Hamano Date: Mon, 9 Apr 2018 23:25:44 +0000 (+0900) Subject: Merge branch 'ml/filter-branch-no-op-error' X-Git-Tag: v2.18.0-rc0~166 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/cb3e97dae806d66ea1859c48b9936d5bfbac9c09?ds=inline;hp=-c Merge branch 'ml/filter-branch-no-op-error' "git filter-branch" learned to use a different exit code to allow the callers to tell the case where there was no new commits to rewrite from other error cases. * ml/filter-branch-no-op-error: filter-branch: return 2 when nothing to rewrite --- cb3e97dae806d66ea1859c48b9936d5bfbac9c09 diff --combined git-filter-branch.sh index 98c76ec589,c285fdb90d..2587a01b9b --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@@ -310,7 -310,7 +310,7 @@@ git rev-list --reverse --topo-order --d die "Could not get the commits" commits=$(wc -l <../revs | tr -d " ") - test $commits -eq 0 && die "Found nothing to rewrite" + test $commits -eq 0 && die_with_status 2 "Found nothing to rewrite" # Rewrite the commits report_progress () @@@ -627,12 -627,12 +627,12 @@@ the 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