Skip to content

Commit d5b873c

Browse files
garimasi514gitster
authored andcommitted
commit-graph: add GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS test flag
Add GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS test flag to the test setup suite in order to toggle writing Bloom filters when running any of the git tests. If set to true, we will compute and write Bloom filters every time a test calls `git commit-graph write`, as if the `--changed-paths` option was passed in. The test suite passes when GIT_TEST_COMMIT_GRAPH and GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS are enabled. Helped-by: Derrick Stolee <[email protected]> Signed-off-by: Garima Singh <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a759bfa commit d5b873c

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

builtin/commit-graph.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ static int graph_write(int argc, const char **argv)
171171
flags |= COMMIT_GRAPH_WRITE_SPLIT;
172172
if (opts.progress)
173173
flags |= COMMIT_GRAPH_WRITE_PROGRESS;
174-
if (opts.enable_changed_paths)
174+
if (opts.enable_changed_paths ||
175+
git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
175176
flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
176177

177178
read_replace_refs = 0;

ci/run-build-and-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ linux-gcc)
1919
export GIT_TEST_OE_SIZE=10
2020
export GIT_TEST_OE_DELTA_SIZE=5
2121
export GIT_TEST_COMMIT_GRAPH=1
22+
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
2223
export GIT_TEST_MULTI_PACK_INDEX=1
2324
export GIT_TEST_ADD_I_USE_BUILTIN=1
2425
make test

commit-graph.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
1111
#define GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD "GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD"
12+
#define GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS "GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS"
1213

1314
struct commit;
1415
struct bloom_filter_settings;

t/README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
378378
be written after every 'git commit' command, and overrides the
379379
'core.commitGraph' setting to true.
380380

381+
GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=<boolean>, when true, forces
382+
commit-graph write to compute and write changed path Bloom filters for
383+
every 'git commit-graph write', as if the `--changed-paths` option was
384+
passed in.
385+
381386
GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
382387
code path for utilizing a file system monitor to speed up detecting
383388
new or changed files.

t/t5318-commit-graph.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
test_description='commit graph'
44
. ./test-lib.sh
55

6+
GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
7+
68
test_expect_success 'setup full repo' '
79
mkdir full &&
810
cd "$TRASH_DIRECTORY/full" &&

t/t5324-split-commit-graph.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ test_description='split commit graph'
44
. ./test-lib.sh
55

66
GIT_TEST_COMMIT_GRAPH=0
7+
GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
78

89
test_expect_success 'setup repo' '
910
git init &&

0 commit comments

Comments
 (0)