-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Provide an option to track to handle paths literally #3756
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
Conversation
PastelMobileSuit
left a comment
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.
✨
Normally, the arguments to "git lfs track" are taken as glob patterns. This is generally useful, but sometimes there are filenames that contain special characters. Add a "--filename" option that forces arguments to be taken as literal paths instead of glob patterns to make handling these files easier. In the test helpers, pass -F to grep so that our unusual file names don't trigger undesired pattern matching. This has no effect on other tests, as they all pass a literal filename here.
|
I've found that the The last entry was added by
|
|
Thanks for the information. I've opened #3785 to fix that. |
|
Thanks for the quick response. I'll test with the fix for #3785 and let you know how it goes. |
|
The fix for #3785 works for me. Thanks for the quick turn around on getting this issue fixed. |
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent commit we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the obvious limitation that if a test uses a filename with a space character in it and tries to match that, there could be confusion; however, none of our existing tests require this at the moment.
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent commit we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the obvious limitation that if a test uses a filename with a space character in it and tries to match that, there could be confusion; however, none of our existing tests require this at the moment.
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent commit we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the obvious limitation that if a test uses a filename with a space character in it and tries to match that, there could be confusion; however, none of our existing tests require this at the moment.
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent PR we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the obvious limitation that if a test uses a filename with a space character in it and tries to match that, there could be confusion; however, none of our existing tests require this at the moment.
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent PR we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the obvious limitation that if a test uses a filename with a space character in it and tries to match that, there could be confusion; however, none of our existing tests require this at the moment.
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent PR we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the obvious limitation that if a test uses a filename with a space character in it and tries to match that, there could be confusion; however, none of our existing tests require this at the moment.
The assert_pointer() and refute_pointer() test helper functions use grep to match specific lines of output from "git ls-tree". However, while assert_pointer() matches with fixed patterns by using grep's -F option, refute_pointer() does not. This difference was introduced in commit fc421da of PR git-lfs#3756, so we update refute_pointer() here to match. In a subsequent PR we will also need to ensure that the file paths we provide as arguments to these functions (specifically, to assert_pointer()) do not match just any part of the paths output by "git ls-tree", but only at the start of the path. That is, "a.bin" should match "a.bin" but not "foo/a.bin". Because the output from "git ls-tree" is space-separated, we prepend a space to our fixed patterns so we match against the start of the file path. This has the limitation that if a test has a file named "foo a.bin", and calls one of these functions with just the filename "a.bin", it will incorrectly match the filename with a space. However, at present only one of our tests that calls either of these functions, specifically the "track: escaped glob pattern with spaces in .gitattributes" test in t/t-track.sh, has a filename with a space in it, and does not create any additional files which might be confused by that filename.
Normally, the arguments to
git lfs trackare taken as glob patterns. This is generally useful, but sometimes there are filenames that contain special characters. Add a--filenameoption that forces arguments to be taken as literal paths instead of glob patterns to make handling these files easier.In the test helpers, pass -F to grep so that our unusual file names don't trigger undesired pattern matching. This has no effect on other tests, as they all pass a literal filename here.
Fixes #3506.