* [PATCH] git-archive: don't die when repository uses subprojects
@ 2007-05-11 16:55 Lars Hjemli
2007-05-12 19:27 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Lars Hjemli @ 2007-05-11 16:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Both archive-tar and archive-zip needed to be taught about subprojects.
The tar function died when trying to read the subproject commit object,
while the zip function reported "unsupported file mode".
This fixes both by representing the subproject as an empty directory.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
archive-tar.c | 4 ++--
archive-zip.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/archive-tar.c b/archive-tar.c
index d9c30d3..56ff356 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -166,7 +166,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
} 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)) {
@@ -278,7 +278,7 @@ static int write_tar_entry(const unsigned char *sha1,
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;
diff --git a/archive-zip.c b/archive-zip.c
index 7c49848..1eaf262 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -182,10 +182,10 @@ static int write_zip_entry(const unsigned char *sha1,
goto out;
}
- if (S_ISDIR(mode)) {
+ if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
method = 0;
attr2 = 16;
- result = READ_TREE_RECURSIVE;
+ result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
out = NULL;
uncompressed_size = 0;
compressed_size = 0;
--
1.5.2.rc3-dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] git-archive: don't die when repository uses subprojects
2007-05-11 16:55 [PATCH] git-archive: don't die when repository uses subprojects Lars Hjemli
@ 2007-05-12 19:27 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2007-05-12 19:27 UTC (permalink / raw)
To: Lars Hjemli; +Cc: git
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-12 19:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11 16:55 [PATCH] git-archive: don't die when repository uses subprojects Lars Hjemli
2007-05-12 19:27 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).