File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed
Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -655,6 +655,7 @@ TEST_PROGRAMS_NEED_X += test-parse-options
655655TEST_PROGRAMS_NEED_X += test-path-utils
656656TEST_PROGRAMS_NEED_X += test-prio-queue
657657TEST_PROGRAMS_NEED_X += test-read-cache
658+ TEST_PROGRAMS_NEED_X += test-write-cache
658659TEST_PROGRAMS_NEED_X += test-ref-store
659660TEST_PROGRAMS_NEED_X += test-regex
660661TEST_PROGRAMS_NEED_X += test-revision-walking
Original file line number Diff line number Diff line change 1+ #include "cache.h"
2+ #include "lockfile.h"
3+
4+ static struct lock_file index_lock ;
5+
6+ int cmd_main (int argc , const char * * argv )
7+ {
8+ int i , cnt = 1 , lockfd ;
9+ if (argc == 2 )
10+ cnt = strtol (argv [1 ], NULL , 0 );
11+ setup_git_directory ();
12+ read_cache ();
13+ for (i = 0 ; i < cnt ; i ++ ) {
14+ lockfd = hold_locked_index (& index_lock , LOCK_DIE_ON_ERROR );
15+ if (0 <= lockfd ) {
16+ write_locked_index (& the_index , & index_lock , COMMIT_LOCK );
17+ } else {
18+ rollback_lock_file (& index_lock );
19+ }
20+ }
21+
22+ return 0 ;
23+ }
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ test_description=" Tests performance of writing the index"
4+
5+ . ./perf-lib.sh
6+
7+ test_perf_default_repo
8+
9+ test_expect_success " setup repo" '
10+ if git rev-parse --verify refs/heads/p0006-ballast^{commit}
11+ then
12+ echo Assuming synthetic repo from many-files.sh
13+ git config --local core.sparsecheckout 1
14+ cat >.git/info/sparse-checkout <<-EOF
15+ /*
16+ !ballast/*
17+ EOF
18+ else
19+ echo Assuming non-synthetic repo...
20+ fi &&
21+ nr_files=$(git ls-files | wc -l)
22+ '
23+
24+ count=3
25+ test_perf " write_locked_index $count times ($nr_files files)" "
26+ test-write-cache $count
27+ "
28+
29+ test_done
You can’t perform that action at this time.
0 commit comments