Commit 0a0eb2e5 authored by Michele Locati's avatar Michele Locati Committed by Junio C Hamano

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's avatarMichele Locati <>
Signed-off-by: default avatarJunio C Hamano <>
parent 38e79b1f
......@@ -222,6 +222,14 @@ this purpose, they are instead rewritten to point at the nearest ancestor that
was not excluded.
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.
......@@ -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 ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment