Skip to content

Conversation

@chrisd8088
Copy link
Member

@chrisd8088 chrisd8088 commented Apr 19, 2022

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 #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.

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 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. See #4758 and #4751 for more details.)

Fixes #4945.
/cc @nuxi as reporter.

@chrisd8088 chrisd8088 added the wip label Apr 19, 2022
@chrisd8088 chrisd8088 force-pushed the gitignore-fetch-filters branch 5 times, most recently from aef4013 to 753e8bb Compare April 25, 2022 08:42
@chrisd8088 chrisd8088 force-pushed the gitignore-fetch-filters branch 2 times, most recently from d273745 to 01746f9 Compare April 28, 2022 03:52
@chrisd8088 chrisd8088 removed the wip label Apr 28, 2022
@chrisd8088 chrisd8088 changed the title [DRAFT] Use gitignore path matching for additional commands Use gitignore-style path matching for additional commands Apr 28, 2022
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.
@chrisd8088 chrisd8088 force-pushed the gitignore-fetch-filters branch from 01746f9 to e61de22 Compare April 28, 2022 05:14
@chrisd8088 chrisd8088 marked this pull request as ready for review April 28, 2022 06:14
@chrisd8088 chrisd8088 requested a review from a team as a code owner April 28, 2022 06:14
Copy link
Member

@bk2204 bk2204 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, having a consistent interpretation here seems like the right thing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lfs.fetchinclude no longer works with directories

2 participants