From 94bc671a1f2e8610de475c2494d2763355a99f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20AVILA?= Date: Sat, 8 Dec 2012 21:04:39 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- archive.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'archive.c') diff --git a/archive.c b/archive.c index 466640479e..93e00bb4ae 100644 --- a/archive.c +++ b/archive.c @@ -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); -- cgit v1.2.1