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)
} else {
if (verbose)
fprintf(stderr, "%.*s\n", path->len, path->buf);
- if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
+ if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
*header.typeflag = TYPEFLAG_DIR;
mode = (mode | 0777) & ~tar_umask;
} else if (S_ISLNK(mode)) {
memcpy(path.buf + baselen, filename, filenamelen);
path.len = baselen + filenamelen;
path.buf[path.len] = '\0';
- if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
+ if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
strbuf_append_string(&path, "/");
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));
}
archive_time = args->time;
verbose = args->verbose;
+ commit = args->commit;
if (args->commit_sha1)
write_global_extended_header(args->commit_sha1);