Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
tar-tree: file/dirmode fix.
author
Junio C Hamano
<junkio@cox.net>
Sat, 4 Mar 2006 05:34:14 +0000
(21:34 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Sat, 4 Mar 2006 05:36:38 +0000
(21:36 -0800)
This fixes two bugs introduced when we switched to generic tree
traversal code.
(1) directory mode recorded silently became 0755, not 0777
(2) if passed a tree object (not a commit), it emitted an
alarming error message (but proceeded anyway).
Signed-off-by: Junio C Hamano <junkio@cox.net>
tar-tree.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
1142038
)
diff --git
a/tar-tree.c
b/tar-tree.c
index e85a1ed6605459fdbb60e3b24022e7e250b93a91..e478e13e283a9d9687d0b32e180558995f2b920d 100644
(file)
--- 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))
}
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? */
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);
}
usage(tar_tree_usage);
}
- commit = lookup_commit_reference
(sha
1);
+ commit = lookup_commit_reference
_gently(sha1,
1);
if (commit) {
write_global_extended_header(commit->object.sha1);
archive_time = commit->date;
if (commit) {
write_global_extended_header(commit->object.sha1);
archive_time = commit->date;