X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=ls-files.c;h=7024cf18e1b739ed4944b89ddddaeff15d59f9ee;hb=701ca744e386c2429ca44072ea987bbb4bdac7ce;hp=6af3b091b049d8ded1999405b4da7191f2b36a4c;hpb=d19e06fa8f86b611c10115903ef7e50d5de112f0;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)