diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2008-04-09 23:14:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-10 00:20:38 -0700 |
commit | ac7fa2776c4a839a5a96c13886714774b52844de (patch) | |
tree | 9d07d1203f5cd3c2bfbd5d2c22f894f36fd805ac /archive-tar.c | |
parent | 3f36cbbaaf87b67abafa851e2808735553f92b06 (diff) | |
download | git-ac7fa2776c4a839a5a96c13886714774b52844de.tar.gz |
git-archive: ignore prefix when checking file attribute
Ulrik Sverdrup noticed that git-archive doesn't correctly apply the attribute
export-subst when the option --prefix is given, too.
When it checked if a file has the attribute turned on, git-archive would try
to look up the full path -- including the prefix -- in .gitattributes. That's
wrong, as the prefix doesn't need to have any relation to any existing
directories, tracked or not.
This patch makes git-archive ignore the prefix when looking up if value of the
attribute export-subst for a file.
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 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/archive-tar.c b/archive-tar.c index 30aa2e23fd..4add80284e 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -17,6 +17,7 @@ static time_t archive_time; static int tar_umask = 002; static int verbose; static const struct commit *commit; +static size_t base_len; /* writes out the whole block, but only if it is full */ static void write_if_needed(void) @@ -251,8 +252,8 @@ static int write_tar_entry(const unsigned char *sha1, buffer = NULL; size = 0; } else { - buffer = sha1_file_to_archive(path.buf, sha1, mode, &type, - &size, commit); + buffer = sha1_file_to_archive(path.buf + base_len, sha1, mode, + &type, &size, commit); if (!buffer) die("cannot read %s", sha1_to_hex(sha1)); } @@ -272,6 +273,7 @@ int write_tar_archive(struct archiver_args *args) archive_time = args->time; verbose = args->verbose; commit = args->commit; + base_len = args->base ? strlen(args->base) : 0; if (args->commit_sha1) write_global_extended_header(args->commit_sha1); |