} else {
if (verbose)
fprintf(stderr, "%.*s\n", path->len, path->buf);
- if (S_ISDIR(mode)) {
+ if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
*header.typeflag = TYPEFLAG_DIR;
mode = (mode | 0777) & ~tar_umask;
} else if (S_ISLNK(mode)) {
static struct strbuf path;
int filenamelen = strlen(filename);
void *buffer;
- char type[20];
+ enum object_type type;
unsigned long size;
if (!path.alloc) {
memcpy(path.buf, base, baselen);
memcpy(path.buf + baselen, filename, filenamelen);
path.len = baselen + filenamelen;
- if (S_ISDIR(mode)) {
+ if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
strbuf_append_string(&path, "/");
buffer = NULL;
size = 0;
} else {
- buffer = read_sha1_file(sha1, type, &size);
+ buffer = read_sha1_file(sha1, &type, &size);
if (!buffer)
die("cannot read %s", sha1_to_hex(sha1));
}