Skip to content

Commit 41e86a3

Browse files
cmarcelogitster
authored andcommitted
filter-branch documentation: non-zero exit status in command abort the filter
Since commit 8c1ce0f filter-branch fails when a <command> has a non-zero exit status. This commit makes it clear in the documentation and also fixes the parent-filter example, that was incorrectly returning non-zero when the commit being tested wasn't the one to be rewritten. Signed-off-by: Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e103343 commit 41e86a3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Documentation/git-filter-branch.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ notable exception of the commit filter, for technical reasons).
5656
Prior to that, the $GIT_COMMIT environment variable will be set to contain
5757
the id of the commit being rewritten. Also, GIT_AUTHOR_NAME,
5858
GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL,
59-
and GIT_COMMITTER_DATE are set according to the current commit.
59+
and GIT_COMMITTER_DATE are set according to the current commit. If any
60+
evaluation of <command> returns a non-zero exit status, the whole operation
61+
will be aborted.
6062

6163
A 'map' function is available that takes an "original sha1 id" argument
6264
and outputs a "rewritten sha1 id" if the commit has been already
@@ -197,7 +199,7 @@ happened). If this is not the case, use:
197199

198200
--------------------------------------------------------------------------
199201
git filter-branch --parent-filter \
200-
'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' HEAD
202+
'test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>" || cat' HEAD
201203
--------------------------------------------------------------------------
202204

203205
or even simpler:

0 commit comments

Comments
 (0)