Skip to content

Conversation

@bk2204
Copy link
Member

@bk2204 bk2204 commented Sep 9, 2019

When we open a pack file, we use a glob pattern to find the pack files that are in our pack directory and then attempt to open them. This works fine if our directory contains no characters that are special to the shell, but works poorly when we handle characters that are special in glob patterns, most notably the left square bracket. In such a case, our pattern doesn't actually match anything, so we don't open any pack files. Git LFS then complains about a missing object.

Escape all the characters which are special to the shell so that we can handle these paths properly. Use character classes instead of backslashes because backslash escaping is not available on Windows. For the same reason, punt on handling backslashes on Unix systems because there isn't a great way to handle them portably.

@bk2204 bk2204 requested a review from a team September 9, 2019 21:52
When we open a pack file, we use a glob pattern to find the pack files
that are in our pack directory and then attempt to open them.  This
works fine if our directory contains no characters that are special to
the shell, but works poorly when we handle characters that are special
in glob patterns, most notably the left square bracket.  In such a case,
our pattern doesn't actually match anything, so we don't open any pack
files.  Git LFS then complains about a missing object.

Escape all the characters which are special to the shell so that we can
handle these paths properly.  Use character classes instead of
backslashes because backslash escaping is not available on Windows.  For
the same reason, punt on handling backslashes on Unix systems because
there isn't a great way to handle them portably.
@bk2204 bk2204 force-pushed the pack-glob-special-chars branch from 5bc4d57 to c513d30 Compare September 9, 2019 21:54
@bk2204 bk2204 merged commit c6c142b into git-lfs:master Sep 10, 2019
@bk2204 bk2204 deleted the pack-glob-special-chars branch September 10, 2019 16:24
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.

2 participants