-
Notifications
You must be signed in to change notification settings - Fork 157
Commitgraph: add new config for changed-paths and recommend it in scalar #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -946,4 +946,69 @@ test_expect_success 'stale commit cannot be parsed when traversing graph' ' | |
) | ||
' | ||
|
||
test_expect_success 'commitGraph.changedPaths=true acts like --changed-paths' ' | ||
git init config-changed-paths-true && | ||
( | ||
cd config-changed-paths-true && | ||
test_commit initial && | ||
test_commit second && | ||
test_commit third && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's a case that we should add:
These tests seem complete and correct, and now I'm providing feedback that is more a matter of "taste" and a preference for succinct tests (especially around config options). Test setup ideas: we only need a single "new" commit to trigger new changed-path filter computations in I'm thinking through a sequence of events that will help (consider a
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Another minor piece of style/taste feedback (and please defer to @derrickstolee and @dscho who are familiar with the preferred style in Git tests). I noticed that all 3 tests are following the same basic approach:
However, the test titles are currently a bit inconsistent:
If we stick with three separate tests, I recommend using the same name scheme across all three. When I first read the titles, I mistakenly thought that we might need another test to validate that |
||
# set commitGraph.changedPaths to true and it should write bloom filters | ||
git config commitGraph.changedPaths true && | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error && | ||
grep -i "bloom filters" error && | ||
# --no-changed-paths should take precedence over the config and erase bloom filters | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --no-changed-paths --reachable --progress 2>error && | ||
! grep -i "bloom filters" error && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently there is some white-space on this otherwise empty line:
Would you mind deleting that, amending the commit, and force-pushing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or: |
||
# --changed-paths should take precedence over the config and add bloom filters | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --changed-paths --reachable --progress 2>error && | ||
grep -i "bloom filters" error | ||
) | ||
' | ||
|
||
test_expect_success 'commitGraph.changedPaths=false respects command line options' ' | ||
git init config-changed-paths-false && | ||
( | ||
cd config-changed-paths-false && | ||
test_commit initial && | ||
test_commit second && | ||
test_commit third && | ||
# set commitGraph.changedPaths to false and it should not write bloom filters | ||
git config commitGraph.changedPaths false && | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error && | ||
! grep -i "bloom filters" error && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a
or drop the |
||
# --changed-paths should take precedence over the config and add bloom filters | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --changed-paths --reachable --progress 2>error && | ||
grep -i "bloom filters" error && | ||
# --no-changed-paths should take precedence over the config and erase bloom filters | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --no-changed-paths --reachable --progress 2>error && | ||
! grep -i "bloom filters" error | ||
) | ||
' | ||
|
||
test_expect_success 'commitGraph.changedPaths=unset respects command line options' ' | ||
git init config-changed-paths-unset && | ||
( | ||
cd config-changed-paths-unset && | ||
test_commit initial && | ||
test_commit second && | ||
test_commit third && | ||
# commitGraph.changedPaths is not set and it should always respect command line options | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --reachable --progress 2>error && | ||
! grep -i "bloom filters" error && | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --changed-paths --reachable --progress 2>error && | ||
grep -i "bloom filters" error && | ||
GIT_PROGRESS_DELAY=0 git commit-graph write --no-changed-paths --reachable --progress 2>error && | ||
! grep -i "bloom filters" error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another super minor piece of style feedback: I noticed that the guts of this test are doing the same as the two new tests above, but the spacing & comments here are inconsistent with the tests above. |
||
) | ||
' | ||
|
||
test_done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this config is loaded before the command-line arguments, we don't want to do this check for
opts.enable_changed_paths == -1
. As we parse the config, we may have duplicate key-value pairs in system, global, or local config and we need to use a "last one wins" approach.We should consider the ability for global config to have it set to
true
and the local config set tofalse
. Right now, thefalse
value is ignored. Wouldopts.enable_changed_paths = git_config_bool(var, value) ? 1 : -1;
give us the right behavior (false
disables the previoustrue
but doesn't actually erase changed-path filters that may otherwise exist).