From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: Matt McCutchen <hashproduct@verizon.net>
Subject: [PATCH] tar-tree: file/dirmode fix.
Date: Fri, 03 Mar 2006 21:35:05 -0800 [thread overview]
Message-ID: <7vy7zqvkl2.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <1141446331.3171.4.camel@mattlaptop> (Matt McCutchen's message of "Fri, 03 Mar 2006 23:25:31 -0500")
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 | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
815afaf1bd0ddf419231d2d9f129260ce1ddbecc
diff --git a/tar-tree.c b/tar-tree.c
index e85a1ed..e478e13 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -304,9 +304,11 @@ static void write_header(const unsigned
}
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;
--
1.2.4.gfe04
prev parent reply other threads:[~2006-03-04 5:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-04 4:25 Producing tar file with 666/777 permissions Matt McCutchen
2006-03-04 5:03 ` Junio C Hamano
2006-03-04 5:35 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vy7zqvkl2.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=hashproduct@verizon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox