Use gitignore-style path matching for additional commands#4951
Merged
chrisd8088 merged 3 commits intogit-lfs:mainfrom Apr 28, 2022
Merged
Use gitignore-style path matching for additional commands#4951chrisd8088 merged 3 commits intogit-lfs:mainfrom
gitignore-style path matching for additional commands#4951chrisd8088 merged 3 commits intogit-lfs:mainfrom
Conversation
aef4013 to
753e8bb
Compare
d273745 to
01746f9
Compare
gitignore path matching for additional commandsgitignore-style path matching for additional commands
The "lfs.fetchinclude" and "lfs.fetchexclude" Git configuration options, if set, are used to control the action of a number of Git LFS commands. Since PR git-lfs#4556, the "git lfs clone", "git lfs fetch", and "git lfs pull" commands have strictly applied gitignore(5)-style matching rules to these configuration options. However, other commands including "git lfs filter-process" and "git lfs smudge" now apply gitattributes(5)-style matching rules to these same configuration options, leading to confusion. We therefore revise all remaining uses of these configuration options to also use gitignore-style matching rules. We also add new tests for the "git lfs filter-process" and "git lfs fsck" commands and adjust or expand existing tests for the "git lfs prune" and "git lfs smudge" commands in order to confirm that gitignore-style matching is used for all of them. These new and updated tests fail if gitattributes-style matching is used instead. (Note that the "git lfs migrate" command does not require any changes because it does not read the "lfs.fetch*" configuration options. Instead, it supplies a "false" value for the "useFetchOptions" flag to the determineIncludeExcludePaths() function, so any "lfs.fetch*" configuration values are ignored. This is significant because "git lfs migrate" deliberately uses gitattributes-style matching for any path patterns supplied via its -I/-X command-line arguments, unlike all other commands that accept -I/-X arguments as overrides for the "lfs.fetch*" configuration options.)
A number of Git LFS commands honour the "lfs.fetchinclude" and/or "lfs.fetchexclude" configuration options, including the "git lfs filter-process", "git lfs fsck", "git lfs prune", and "git lfs smudge" commands. We therefore update the existing documentation on how these filter configuration options function, and add additional notes on their operation with regard to several other commands. We also fix a few formatting issues and references as well.
01746f9 to
e61de22
Compare
bk2204
approved these changes
Apr 28, 2022
Member
bk2204
left a comment
There was a problem hiding this comment.
Yeah, having a consistent interpretation here seems like the right thing to do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
lfs.fetchincludeandlfs.fetchexcludeGit configuration options, if set, are used to control the action of a number of Git LFS commands. Since PR #4556, thegit lfs clone,git lfs fetch, andgit lfs pullcommands have strictly appliedgitignore(5)-style matching rules to these configuration options.However, other commands including
git lfs filter-processandgit lfs smudgenow applygitattributes(5)-style matching rules to these same configuration options, leading to confusion.We therefore revise all remaining uses of these configuration options to also use
gitignore-style matching rules.We also add new tests for the
git lfs filter-processandgit lfs fsckcommands and adjust or expand existing tests for thegit lfs pruneandgit lfs smudgecommands in order to confirm thatgitignore-style matching is used for all of them. These new and updated tests fail ifgitattributes-style matching is used instead.As well, we update the existing manual page documentation on how these
lfs.fetch*filter configuration options function, and add additional notes on their operation with regard to several other commands, and we fix a few related formatting issues and missing references.(Note that the
git lfs migratecommand does not require any changes because it does not read thelfs.fetch*configuration options. Instead, it supplies afalsevalue for theuseFetchOptionsflag to thedetermineIncludeExcludePaths()function, so anylfs.fetch*configuration values are ignored. This is significant becausegit lfs migratedeliberately usesgitattributes-style matching for any path patterns supplied via its-I/-Xcommand-line arguments, unlike all other commands that accept-I/-Xarguments as overrides for thelfs.fetch*configuration options. See #4758 and #4751 for more details.)Fixes #4945.
/cc @nuxi as reporter.