File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -306,14 +306,26 @@ then
306
306
start_timestamp=$( date ' +%s' )
307
307
fi
308
308
309
+ if test -n " $filter_index " ||
310
+ test -n " $filter_tree " ||
311
+ test -n " $filter_subdir "
312
+ then
313
+ need_index=t
314
+ else
315
+ need_index=
316
+ fi
317
+
309
318
while read commit parents; do
310
319
git_filter_branch__commit_count=$(( $git_filter_branch__commit_count + 1 ))
311
320
312
321
report_progress
313
322
314
323
case " $filter_subdir " in
315
324
" " )
316
- GIT_ALLOW_NULL_SHA1=1 git read-tree -i -m $commit
325
+ if test -n " $need_index "
326
+ then
327
+ GIT_ALLOW_NULL_SHA1=1 git read-tree -i -m $commit
328
+ fi
317
329
;;
318
330
* )
319
331
# The commit may not have the subdirectory at all
@@ -387,8 +399,15 @@ while read commit parents; do
387
399
} < ../commit |
388
400
eval " $filter_msg " > ../message ||
389
401
die " msg filter failed: $filter_msg "
402
+
403
+ if test -n " $need_index "
404
+ then
405
+ tree=$( git write-tree)
406
+ else
407
+ tree=" $commit ^{tree}"
408
+ fi
390
409
workdir=$workdir @SHELL_PATH@ -c " $filter_commit " " git commit-tree" \
391
- $( git write- tree) $parentstr < ../message > ../map/$commit ||
410
+ " $ tree" $parentstr < ../message > ../map/$commit ||
392
411
die " could not write rewritten commit"
393
412
done < ../revs
394
413
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ test_description=' performance of filter-branch'
4
+ . ./perf-lib.sh
5
+
6
+ test_perf_default_repo
7
+ test_checkout_worktree
8
+
9
+ test_expect_success ' mark bases for tests' '
10
+ git tag -f tip &&
11
+ git tag -f base HEAD~100
12
+ '
13
+
14
+ test_perf ' noop filter' '
15
+ git checkout --detach tip &&
16
+ git filter-branch -f base..HEAD
17
+ '
18
+
19
+ test_done
You can’t perform that action at this time.
0 commit comments