We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e53c7f8 + bec5ab8 commit c1462b8Copy full SHA for c1462b8
1 file changed
dir.c
@@ -174,20 +174,19 @@ char *common_prefix(const struct pathspec *pathspec)
174
175
int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
176
{
177
- char *prefix;
+ const char *prefix;
178
size_t prefix_len;
179
180
/*
181
* Calculate common prefix for the pathspec, and
182
* use that to optimize the directory walk
183
*/
184
- prefix = common_prefix(pathspec);
185
- prefix_len = prefix ? strlen(prefix) : 0;
+ prefix_len = common_prefix_len(pathspec);
+ prefix = prefix_len ? pathspec->items[0].match : "";
186
187
/* Read the directory and prune it */
188
read_directory(dir, prefix, prefix_len, pathspec);
189
190
- free(prefix);
191
return prefix_len;
192
}
193
0 commit comments