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 state:filter.map 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 <michael.barabanov@gmail.com>
Acked-by: Ian Campbell's avatarIan Campbell <ijc@hellion.org.uk>
Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
parent fc54c1af
......@@ -360,6 +360,7 @@ while read commit parents; do
git_filter_branch__commit_count=$(($git_filter_branch__commit_count+1))
report_progress
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