diff options
author | Jean-Noël AVILA <avila.jn@gmail.com> | 2012-12-08 21:04:39 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-17 22:07:23 -0800 |
commit | 94bc671a1f2e8610de475c2494d2763355a99f65 (patch) | |
tree | ee7215f3ca5209152ba36b82955d8e12160fb425 /archive.c | |
parent | 24a62db7bbcbd8083bd0070ecd434205489629ed (diff) | |
download | git-94bc671a1f2e8610de475c2494d2763355a99f65.tar.gz |
Add directory pattern matching to attributes
The manpage of gitattributes says: "The rules how the pattern
matches paths are the same as in .gitignore files" and the gitignore
pattern matching has a pattern ending with / for directory matching.
This rule is specifically relevant for the 'export-ignore' rule used
for git archive.
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive.c')
-rw-r--r-- | archive.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -120,6 +120,8 @@ static int write_archive_entry(const unsigned char *sha1, const char *base, strbuf_add(&path, args->base, args->baselen); strbuf_add(&path, base, baselen); strbuf_addstr(&path, filename); + if (S_ISDIR(mode) || S_ISGITLINK(mode)) + strbuf_addch(&path, '/'); path_without_prefix = path.buf + args->baselen; setup_archive_check(check); @@ -130,7 +132,6 @@ static int write_archive_entry(const unsigned char *sha1, const char *base, } if (S_ISDIR(mode) || S_ISGITLINK(mode)) { - strbuf_addch(&path, '/'); if (args->verbose) fprintf(stderr, "%.*s\n", (int)path.len, path.buf); err = write_entry(args, sha1, path.buf, path.len, mode); |