diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2007-09-03 20:07:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-03 16:46:16 -0700 |
commit | 8460b2fcd45668d91567c36a22ea4f1b14ba133d (patch) | |
tree | df399f035df047c2236ff919e2654c5eff4fce0c /archive-tar.c | |
parent | Export format_commit_message() (diff) | |
download | tgif-8460b2fcd45668d91567c36a22ea4f1b14ba133d.tar.xz |
archive: specfile support (--pretty=format: in archive files)
Add support for a new attribute, specfile. Files marked as being
specfiles are expanded by git-archive when they are written to an
archive. It has no effect on worktree files. The same placeholders
as those for the option --pretty=format: of git-log et al. can be
used.
The attribute is useful for creating auto-updating specfiles. It is
limited by the underlying function format_commit_message(), though.
E.g. currently there is no placeholder for git-describe like output,
and expanded specfiles can't contain NUL bytes. That can be fixed
in format_commit_message() later and will then benefit users of
git-log, too.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive-tar.c')
-rw-r--r-- | archive-tar.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/archive-tar.c b/archive-tar.c index 66fe3e375b..c0d95dab0d 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -17,6 +17,7 @@ static unsigned long offset; static time_t archive_time; static int tar_umask = 002; static int verbose; +static const struct commit *commit; /* writes out the whole block, but only if it is full */ static void write_if_needed(void) @@ -285,7 +286,8 @@ static int write_tar_entry(const unsigned char *sha1, buffer = NULL; size = 0; } else { - buffer = convert_sha1_file(path.buf, sha1, mode, &type, &size); + buffer = sha1_file_to_archive(path.buf, sha1, mode, &type, + &size, commit); if (!buffer) die("cannot read %s", sha1_to_hex(sha1)); } @@ -304,6 +306,7 @@ int write_tar_archive(struct archiver_args *args) archive_time = args->time; verbose = args->verbose; + commit = args->commit; if (args->commit_sha1) write_global_extended_header(args->commit_sha1); |