1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-30 23:06:09 +02:00

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: Michael Barabanov <michael.barabanov@gmail.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Barabanov 2018-06-25 21:07:33 -07:00 committed by Junio C Hamano
parent fc54c1af3e
commit 709cfe848a
2 changed files with 16 additions and 0 deletions

View File

@ -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
"")

View File

@ -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 &&