Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Documentation/config/commitgraph.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ commitGraph.maxNewFilters::
Specifies the default value for the `--max-new-filters` option of `git
commit-graph write` (c.f., linkgit:git-commit-graph[1]).

commitGraph.changedPaths::
If true, then `git commit-graph write` will compute and write
changed-path Bloom filters by default, equivalent to passing
`--changed-paths`. If false or unset, changed-path Bloom filters
will only be written when explicitly requested via `--changed-paths`.
Command-line options always take precedence over this configuration.
Defaults to unset.

commitGraph.readChangedPaths::
Deprecated. Equivalent to commitGraph.changedPathsVersion=-1 if true, and
commitGraph.changedPathsVersion=0 if false. (If commitGraph.changedPathVersion
Expand Down
2 changes: 2 additions & 0 deletions builtin/commit-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ static int git_commit_graph_write_config(const char *var, const char *value,
{
if (!strcmp(var, "commitgraph.maxnewfilters"))
write_opts.max_new_filters = git_config_int(var, value, ctx->kvi);
else if (!strcmp(var, "commitgraph.changedpaths"))
opts.enable_changed_paths = git_config_bool(var, value) ? 1 : -1;
/*
* No need to fall-back to 'git_default_config', since this was already
* called in 'cmd_commit_graph()'.
Expand Down
1 change: 1 addition & 0 deletions scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ static int set_recommended_config(int reconfigure)
#endif
/* Optional */
{ "status.aheadBehind", "false" },
{ "commitGraph.changedPaths", "true" },
{ "commitGraph.generationVersion", "1" },
{ "core.autoCRLF", "false" },
{ "core.safeCRLF", "false" },
Expand Down
44 changes: 44 additions & 0 deletions t/t5318-commit-graph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,48 @@ test_expect_success 'stale commit cannot be parsed when traversing graph' '
)
'

test_expect_success 'config commitGraph.changedPaths acts like --changed-paths' '
git init config-changed-paths &&
(
cd config-changed-paths &&

# commitGraph.changedPaths is not set and it should not write Bloom filters
test_commit first &&
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error &&
test_grep ! "Bloom filters" error &&

# Set commitGraph.changedPaths to true and it should write Bloom filters
test_commit second &&
git config commitGraph.changedPaths true &&
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error &&
test_grep "Bloom filters" error &&

# Add one more config commitGraph.changedPaths as false to disable the previous true config value
# It should still write Bloom filters due to existing filters
test_commit third &&
git config --add commitGraph.changedPaths false &&
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error &&
test_grep "Bloom filters" error &&

# commitGraph.changedPaths is still false and command line options should take precedence
test_commit fourth &&
GIT_PROGRESS_DELAY=0 git commit-graph write --no-changed-paths --reachable --progress 2>error &&
test_grep ! "Bloom filters" error &&
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error &&
test_grep ! "Bloom filters" error &&

# commitGraph.changedPaths is all cleared and then set to false again, command line options should take precedence
test_commit fifth &&
git config --unset-all commitGraph.changedPaths &&
git config commitGraph.changedPaths false &&
GIT_PROGRESS_DELAY=0 git commit-graph write --changed-paths --reachable --progress 2>error &&
test_grep "Bloom filters" error &&

# commitGraph.changedPaths is still false and it should write Bloom filters due to existing filters
test_commit sixth &&
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error &&
test_grep "Bloom filters" error
)
'

test_done
Loading