X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=archive.c;h=9ac455d889b72deba8c949da1d9efe2be3a50244;hb=aebd173ffa7a4e67447f0157a14abde7767c54e9;hp=5b40e261f10e42b9f9ee9b4dbfe231765156bf64;hpb=c8a4cbc23916feeae89a7c59523781e8bf8ac103;p=git.git diff --git a/archive.c b/archive.c index 5b40e261f..9ac455d88 100644 --- a/archive.c +++ b/archive.c @@ -15,7 +15,7 @@ static char const * const archive_usage[] = { #define USES_ZLIB_COMPRESSION 1 -const struct archiver { +static const struct archiver { const char *name; write_archive_fn_t write_archive; unsigned int flags; @@ -29,11 +29,10 @@ static void format_subst(const struct commit *commit, struct strbuf *buf) { char *to_free = NULL; - struct strbuf fmt; + struct strbuf fmt = STRBUF_INIT; if (src == buf->buf) to_free = strbuf_detach(buf, NULL); - strbuf_init(&fmt, 0); for (;;) { const char *b, *c; @@ -48,7 +47,7 @@ static void format_subst(const struct commit *commit, strbuf_add(&fmt, b + 8, c - b - 8); strbuf_add(buf, src, b - src); - format_commit_message(commit, fmt.buf, buf); + format_commit_message(commit, fmt.buf, buf, DATE_NORMAL); len -= c + 1 - src; src = c + 1; } @@ -65,10 +64,9 @@ static void *sha1_file_to_archive(const char *path, const unsigned char *sha1, buffer = read_sha1_file(sha1, type, sizep); if (buffer && S_ISREG(mode)) { - struct strbuf buf; + struct strbuf buf = STRBUF_INIT; size_t size = 0; - strbuf_init(&buf, 0); strbuf_attach(&buf, buffer, *sizep, *sizep + 1); convert_to_working_tree(path, buf.buf, buf.len, &buf); if (commit) @@ -338,5 +336,7 @@ int write_archive(int argc, const char **argv, const char *prefix, parse_treeish_arg(argv, &args, prefix); parse_pathspec_arg(argv + 1, &args); + git_config(git_default_config, NULL); + return ar->write_archive(&args); }