aboutsummaryrefslogtreecommitdiff
path: root/archive-tar.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-04-10 00:29:33 -0700
committerJunio C Hamano <gitster@pobox.com>2008-04-10 00:29:33 -0700
commit179c94b24ae87e28328f9b311489417b66bd62c9 (patch)
tree3458de6031a61992cf96700826c29096867cae43 /archive-tar.c
parent1d2375ddfee18bd3effd2c1f98527cc2f8b1df0a (diff)
parentabea85d1e9ee0bd77e41e934534aa5d5cdd0593a (diff)
downloadgit-179c94b24ae87e28328f9b311489417b66bd62c9.tar.gz
git-179c94b24ae87e28328f9b311489417b66bd62c9.tar.xz
Merge branch 'maint-1.5.4' into maint
* maint-1.5.4: core-tutorial.txt: Fix showing the current behaviour. git-archive: ignore prefix when checking file attribute Fix documentation syntax of optional arguments in short options.
Diffstat (limited to 'archive-tar.c')
-rw-r--r--archive-tar.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/archive-tar.c b/archive-tar.c
index 30aa2e23f..4add80284 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);