filter-branch: return 2 when nothing to rewrite
authorMichele Locati <michele@locati.it>
Thu, 15 Mar 2018 17:09:18 +0000 (18:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Mar 2018 17:41:51 +0000 (10:41 -0700)
Using the --state-branch option allows us to perform incremental filtering.
This may lead to having nothing to rewrite in subsequent filtering, so we need
a way to recognize this case.
So, let's exit with 2 instead of 1 when this "error" occurs.

Signed-off-by: Michele Locati <michele@locati.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 1b7e4b2cdbdf36e090c4b1f531dcc48222d8f8b1..c285fdb90d1a86cd2f360e3ff1768c82a7162fd5 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 ()