Commit 709cfe84 authored by Michael Barabanov's avatar Michael Barabanov Committed by Junio C Hamano

filter-branch: skip commits present on --state-branch

The commits in have already been processed, so don't
filter them again. This makes incremental git filter-branch much faster.

Also add tests for --state-branch option.
Signed-off-by: 's avatarMichael Barabanov <>
Acked-by: Ian Campbell's avatarIan Campbell <>
Signed-off-by: 's avatarJunio C Hamano <>
parent fc54c1af
......@@ -360,6 +360,7 @@ while read commit parents; do
test -f "$workdir"/../map/$commit && continue
case "$filter_subdir" in
......@@ -107,6 +107,21 @@ test_expect_success 'test that the directory was renamed' '
test dir/D = "$(cat diroh/D.t)"
V=$(git rev-parse HEAD)
test_expect_success 'populate --state-branch' '
git filter-branch --state-branch state -f --tree-filter "touch file || :" HEAD
W=$(git rev-parse HEAD)
test_expect_success 'using --state-branch to skip already rewritten commits' '
test_when_finished git reset --hard $V &&
git reset --hard $V &&
git filter-branch --state-branch state -f --tree-filter "touch file || :" HEAD &&
test_cmp_rev $W HEAD
git tag oldD HEAD~4
test_expect_success 'rewrite one branch, keeping a side branch' '
git branch modD oldD &&
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