X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=ls-files.c;h=7024cf18e1b739ed4944b89ddddaeff15d59f9ee;hb=44de0da4f908b6600647673e1236b0ca504a9c15;hp=6af3b091b049d8ded1999405b4da7191f2b36a4c;hpb=7cb038a692ec0bdc0f442380678e8e87e26d4e68;p=git.git diff --git a/ls-files.c b/ls-files.c index 6af3b091..7024cf18 100644 --- a/ls-files.c +++ b/ls-files.c @@ -474,8 +474,28 @@ static void show_files(void) const char *path = ".", *base = ""; int baselen = prefix_len; - if (baselen) + if (baselen) { path = base = prefix; + if (exclude_per_dir) { + char *p, *pp = xmalloc(baselen+1); + memcpy(pp, prefix, baselen+1); + p = pp; + while (1) { + char save = *p; + *p = 0; + push_exclude_per_directory(pp, p-pp); + *p++ = save; + if (!save) + break; + p = strchr(p, '/'); + if (p) + p++; + else + p = pp + baselen; + } + free(pp); + } + } read_directory(path, base, baselen); qsort(dir, nr_dir, sizeof(struct nond_on_fs *), cmp_name); if (show_others)