Merge branch 'ml/filter-branch-no-op-error'
authorJunio C Hamano <gitster@pobox.com>
Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)
"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

Documentation/git-filter-branch.txt
git-filter-branch.sh
index 3a52e4dce39eeaf6eba896ccbf9e0505cebb3ec9..b634043183b453a89b3f56e0544503b06ccdbdec 100644 (file)
@@ -222,6 +222,14 @@ this purpose, they are instead rewritten to point at the nearest ancestor that
 was not excluded.
 
 
+EXIT STATUS
+-----------
+
+On success, the exit status is `0`.  If the filter can't find any commits to
+rewrite, the exit status is `2`.  On any other error, the exit status may be
+any other non-zero value.
+
+
 Examples
 --------
 
index 98c76ec589b053c112ddc86b6821f2acf17b7ab0..2587a01b9b4fa0344c695cb635e6eed26257e9f8 100755 (executable)
@@ -310,7 +310,7 @@ git rev-list --reverse --topo-order --default HEAD \
        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 ()