filter-branch: return 2 when nothing to rewrite
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>
Michele Locati committed
Mar 15, 2018 at 18:09 UTC
0a0eb2e585788567094248652fc20450a0db642b
2 files changed
+9
-1
Documentation/git-filter-branch.txt
+8
@@ -222,6 +222,14 @@ this purpose, they are instead rewritten to point at the nearest ancestor that
222
was not excluded.
223
224
225
+EXIT STATUS
226
+-----------
227
+
228
+On success, the exit status is `0`. If the filter can't find any commits to
229
+rewrite, the exit status is `2`. On any other error, the exit status may be
230
+any other non-zero value.
231
+
232
+
233
Examples
234
--------
235
git-filter-branch.sh
+1
-1
@@ -310,7 +310,7 @@ git rev-list --reverse --topo-order --default HEAD \
310
die "Could not get the commits"
311
commits=$(wc -l <../revs | tr -d " ")
312
313
-test $commits -eq 0 && die "Found nothing to rewrite"
313
+test $commits -eq 0 && die_with_status 2 "Found nothing to rewrite"
314
315
# Rewrite the commits
316
report_progress ()