summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-03 21:36:52 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-03 21:36:52 -0800
commitbe972922d034e4b007e0f644a7285266863f2cbc (patch)
treecd83a3bbf742c707c8b86104434ae637814a29f1
parentce4c8b24a1efcf155c076d54a7e239251504f669 (diff)
parent473d404b53488a17458beea81913c1bc5df47a8a (diff)
downloadgit-be972922d034e4b007e0f644a7285266863f2cbc.tar.gz
Merge branch 'maint'
* maint: tar-tree: file/dirmode fix.
-rw-r--r--tar-tree.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tar-tree.c b/tar-tree.c
index e85a1ed660..e478e13e28 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -304,9 +304,11 @@ static void write_header(const unsigned char *sha1, char typeflag, const char *b
}
if (S_ISDIR(mode))
- mode |= 0755; /* GIT doesn't store permissions of dirs */
- if (S_ISLNK(mode))
- mode |= 0777; /* ... nor of symlinks */
+ mode |= 0777;
+ else if (S_ISREG(mode))
+ mode |= (mode & 0100) ? 0777 : 0666;
+ else if (S_ISLNK(mode))
+ mode |= 0777;
sprintf(&header[100], "%07o", mode & 07777);
/* XXX: should we provide more meaningful info here? */
@@ -391,7 +393,7 @@ int main(int argc, char **argv)
usage(tar_tree_usage);
}
- commit = lookup_commit_reference(sha1);
+ commit = lookup_commit_reference_gently(sha1, 1);
if (commit) {
write_global_extended_header(commit->object.sha1);
archive_time = commit->date;