@matheusbsbs / matheus-bagliano / commits / d5b873c832
Fork 0

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 <dstolee@microsoft.com> Signed-off-by: Garima Singh <garima.singh@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Garima Singh committed Apr 6, 2020 at 16:59 UTC d5b873c832d832e44523d1d2a9d29afe2b84c84f
6 files changed +12 -1
builtin/commit-graph.c
+2 -1
@@ -171,7 +171,8 @@ static int graph_write(int argc, const char **argv)
171 flags |= COMMIT_GRAPH_WRITE_SPLIT;
172 if (opts.progress)
173 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))
176 flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
177
178 read_replace_refs = 0;
ci/run-build-and-tests.sh
+1
@@ -19,6 +19,7 @@ linux-gcc)
19 export GIT_TEST_OE_SIZE=10
20 export GIT_TEST_OE_DELTA_SIZE=5
21 export GIT_TEST_COMMIT_GRAPH=1
22 + export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
23 export GIT_TEST_MULTI_PACK_INDEX=1
24 export GIT_TEST_ADD_I_USE_BUILTIN=1
25 make test
commit-graph.h
+1
@@ -9,6 +9,7 @@
9
10 #define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
11 #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"
13
14 struct commit;
15 struct bloom_filter_settings;
t/README
+5
@@ -378,6 +378,11 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
378 be written after every 'git commit' command, and overrides the
379 'core.commitGraph' setting to true.
380
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 +
386 GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
387 code path for utilizing a file system monitor to speed up detecting
388 new or changed files.
t/t5318-commit-graph.sh
+2
@@ -3,6 +3,8 @@
3 test_description='commit graph'
4 . ./test-lib.sh
5
6 +GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
7 +
8 test_expect_success 'setup full repo' '
9 mkdir full &&
10 cd "$TRASH_DIRECTORY/full" &&
t/t5324-split-commit-graph.sh
+1
@@ -4,6 +4,7 @@ test_description='split commit graph'
4 . ./test-lib.sh
5
6 GIT_TEST_COMMIT_GRAPH=0
7 +GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
8
9 test_expect_success 'setup repo' '
10 git init &&