{"thread":{"id":"8084","subject":"[PATCH] git-archive: don't die when repository uses subprojects","startedAt":"2007-05-11T16:55:21Z","lastAt":"2007-05-12T19:27:51Z","messageCount":2,"participants":["Lars Hjemli","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"41839","messageId":"11789025212823-git-send-email-hjemli@gmail.com","threadId":"8084","inReplyTo":null,"subject":"[PATCH] git-archive: don't die when repository uses subprojects","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-05-11T16:55:21Z","receivedAt":"2007-05-11T16:55:21Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Both archive-tar and archive-zip needed to be taught about subprojects.\nThe tar function died when trying to read the subproject commit object,\nwhile the zip function reported \"unsupported file mode\".\n\nThis fixes both by representing the subproject as an empty directory.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n archive-tar.c |    4 ++--\n archive-zip.c |    4 ++--\n 2 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex d9c30d3..56ff356 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -166,7 +166,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,\n \t} else {\n \t\tif (verbose)\n \t\t\tfprintf(stderr, \"%.*s\\n\", path->len, path->buf);\n-\t\tif (S_ISDIR(mode)) {\n+\t\tif (S_ISDIR(mode) || S_ISDIRLNK(mode)) {\n \t\t\t*header.typeflag = TYPEFLAG_DIR;\n \t\t\tmode = (mode | 0777) & ~tar_umask;\n \t\t} else if (S_ISLNK(mode)) {\n@@ -278,7 +278,7 @@ static int write_tar_entry(const unsigned char *sha1,\n \tmemcpy(path.buf, base, baselen);\n \tmemcpy(path.buf + baselen, filename, filenamelen);\n \tpath.len = baselen + filenamelen;\n-\tif (S_ISDIR(mode)) {\n+\tif (S_ISDIR(mode) || S_ISDIRLNK(mode)) {\n \t\tstrbuf_append_string(&path, \"/\");\n \t\tbuffer = NULL;\n \t\tsize = 0;\ndiff --git a/archive-zip.c b/archive-zip.c\nindex 7c49848..1eaf262 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -182,10 +182,10 @@ static int write_zip_entry(const unsigned char *sha1,\n \t\tgoto out;\n \t}\n \n-\tif (S_ISDIR(mode)) {\n+\tif (S_ISDIR(mode) || S_ISDIRLNK(mode)) {\n \t\tmethod = 0;\n \t\tattr2 = 16;\n-\t\tresult = READ_TREE_RECURSIVE;\n+\t\tresult = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);\n \t\tout = NULL;\n \t\tuncompressed_size = 0;\n \t\tcompressed_size = 0;\n-- \n1.5.2.rc3-dirty\n"},{"id":"41953","messageId":"7vsla1yh8o.fsf@assigned-by-dhcp.cox.net","threadId":"8084","inReplyTo":"11789025212823-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] git-archive: don't die when repository uses subprojects","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-12T19:27:51Z","receivedAt":"2007-05-12T19:27:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}