]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-graph: add GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS test flag
authorGarima Singh <garima.singh@microsoft.com>
Mon, 6 Apr 2020 16:59:55 +0000 (16:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Apr 2020 18:08:37 +0000 (11:08 -0700)
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>
builtin/commit-graph.c
ci/run-build-and-tests.sh
commit-graph.h
t/README
t/t5318-commit-graph.sh
t/t5324-split-commit-graph.sh

index cacb5d04a80f70f70f3b84a06942a730a0d36a52..59009837dc9f792a825bc5217c66e93881a85b46 100644 (file)
@@ -171,7 +171,8 @@ static int graph_write(int argc, const char **argv)
                flags |= COMMIT_GRAPH_WRITE_SPLIT;
        if (opts.progress)
                flags |= COMMIT_GRAPH_WRITE_PROGRESS;
-       if (opts.enable_changed_paths)
+       if (opts.enable_changed_paths ||
+           git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
                flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
 
        read_replace_refs = 0;
index 4df54c4efea8930e34f76205afa92b67e4275662..17e25aade96f46ecfcdf1b5658d788f23b99f587 100755 (executable)
@@ -19,6 +19,7 @@ linux-gcc)
        export GIT_TEST_OE_SIZE=10
        export GIT_TEST_OE_DELTA_SIZE=5
        export GIT_TEST_COMMIT_GRAPH=1
+       export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
        export GIT_TEST_MULTI_PACK_INDEX=1
        export GIT_TEST_ADD_I_USE_BUILTIN=1
        make test
index 8e7a8e0e5b235bef08bbecdbe10d4147c6d3b391..8655d064c14496a9bfa210fa55b9ca5ae59ae3d4 100644 (file)
@@ -9,6 +9,7 @@
 
 #define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
 #define GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD "GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD"
+#define GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS "GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS"
 
 struct commit;
 struct bloom_filter_settings;
index da5b24feb00374dc03fecc3a456ae54d6c6a634f..8ad9bc13d823154f0dee226ce3cebfbfb57d35ca 100644 (file)
--- a/t/README
+++ b/t/README
@@ -378,6 +378,11 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
 be written after every 'git commit' command, and overrides the
 'core.commitGraph' setting to true.
 
+GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=<boolean>, when true, forces
+commit-graph write to compute and write changed path Bloom filters for
+every 'git commit-graph write', as if the `--changed-paths` option was
+passed in.
+
 GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
 code path for utilizing a file system monitor to speed up detecting
 new or changed files.
index 9bf920ae1716dd3703d206be05605cfdfde21984..18304a65e4d90980c0376cb78ed0d309b46f68ac 100755 (executable)
@@ -3,6 +3,8 @@
 test_description='commit graph'
 . ./test-lib.sh
 
+GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
+
 test_expect_success 'setup full repo' '
        mkdir full &&
        cd "$TRASH_DIRECTORY/full" &&
index 53b2e6b4555de7d7cc27c727e2e7a3d7a4ff3f5b..d3f1f2c4a71bbfd2bdeea2ac2902d44bc88c7467 100755 (executable)
@@ -4,6 +4,7 @@ test_description='split commit graph'
 . ./test-lib.sh
 
 GIT_TEST_COMMIT_GRAPH=0
+GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
 
 test_expect_success 'setup repo' '
        git init &&