Merge branch 'jk/strip-suffix'
* jk/strip-suffix: prepare_packed_git_one: refactor duplicate-pack check verify-pack: use strbuf_strip_suffix strbuf: implement strbuf_strip_suffix index-pack: use strip_suffix to avoid magic numbers use strip_suffix instead of ends_with in simple cases replace has_extension with ends_with implement ends_with via strip_suffix add strip_suffix function sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one()
This commit is contained in:
5
help.c
5
help.c
@ -144,7 +144,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
|
||||
|
||||
while ((de = readdir(dir)) != NULL) {
|
||||
const char *ent;
|
||||
int entlen;
|
||||
size_t entlen;
|
||||
|
||||
if (!skip_prefix(de->d_name, prefix, &ent))
|
||||
continue;
|
||||
@ -155,8 +155,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
|
||||
continue;
|
||||
|
||||
entlen = strlen(ent);
|
||||
if (has_extension(ent, ".exe"))
|
||||
entlen -= 4;
|
||||
strip_suffix(ent, ".exe", &entlen);
|
||||
|
||||
add_cmdname(cmds, ent, entlen);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user