Commit c513d30
committed
pack: escape characters before using them in glob patterns
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.1 parent 8efea4e commit c513d30
1 file changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
94 | 110 | | |
95 | 111 | | |
96 | 112 | | |
| |||
0 commit comments