{"thread":{"id":"3545","subject":"Producing tar file with 666/777 permissions","startedAt":"2006-03-04T04:25:31Z","lastAt":"2006-03-04T05:35:05Z","messageCount":3,"participants":["Matt McCutchen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"17133","messageId":"1141446331.3171.4.camel@mattlaptop","threadId":"3545","inReplyTo":null,"subject":"Producing tar file with 666/777 permissions","fromName":"Matt McCutchen","fromEmail":"hashproduct@verizon.net","sentAt":"2006-03-04T04:25:31Z","receivedAt":"2006-03-04T04:25:31Z","isPatch":false,"sender":{"key":"hashproduct@verizon.net","avatar":null},"body":"Dear GIT people,\n\nHow do I package a git repository in a tar file with 666 and 777\nembedded permissions?  There's evidently some way to do it because the\nLinux kernel source packages have 666 and 777 embedded permissions, but\ngit-tar-tree gives me a tar file with 644 and 755 permissions and\nthere's no obvious way to tell it to do otherwise.\n\nThere was lots of discussion on the mailing list about what permissions\nto preserve when copying in and out of repositories (I obviously side\nwith those who want a single execute bit), but I could not find any\nmention of permission issues in reference to git-tar-tree.\n\nPlease reply to me as I am off-list.\n-- \nMatt McCutchen\nhashproduct@verizon.net\nhttp://hashproduct.metaesthetics.net/\n"},{"id":"17135","messageId":"7v7j7ax0le.fsf@assigned-by-dhcp.cox.net","threadId":"3545","inReplyTo":"1141446331.3171.4.camel@mattlaptop","subject":"Re: Producing tar file with 666/777 permissions","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-04T05:03:57Z","receivedAt":"2006-03-04T05:03:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matt McCutchen <hashproduct@verizon.net> writes:\n\n> Dear GIT people,\n>\n> How do I package a git repository in a tar file with 666 and 777\n> embedded permissions?  There's evidently some way to do it because the\n> Linux kernel source packages have 666 and 777 embedded permissions, but\n> git-tar-tree gives me a tar file with 644 and 755 permissions and\n> there's no obvious way to tell it to do otherwise.\n\nOuch, thanks for reporting this.  You have spotted a recent\nregression.\n"},{"id":"17136","messageId":"7vy7zqvkl2.fsf@assigned-by-dhcp.cox.net","threadId":"3545","inReplyTo":"1141446331.3171.4.camel@mattlaptop","subject":"[PATCH] tar-tree: file/dirmode fix.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-04T05:35:05Z","receivedAt":"2006-03-04T05:35:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This fixes two bugs introduced when we switched to generic tree\ntraversal code.\n\n (1) directory mode recorded silently became 0755, not 0777\n\n (2) if passed a tree object (not a commit), it emitted an\n     alarming error message (but proceeded anyway).\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n tar-tree.c |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\n815afaf1bd0ddf419231d2d9f129260ce1ddbecc\ndiff --git a/tar-tree.c b/tar-tree.c\nindex e85a1ed..e478e13 100644\n--- a/tar-tree.c\n+++ b/tar-tree.c\n@@ -304,9 +304,11 @@ static void write_header(const unsigned \n \t}\n \n \tif (S_ISDIR(mode))\n-\t\tmode |= 0755;\t/* GIT doesn't store permissions of dirs */\n-\tif (S_ISLNK(mode))\n-\t\tmode |= 0777;   /* ... nor of symlinks */\n+\t\tmode |= 0777;\n+\telse if (S_ISREG(mode))\n+\t\tmode |= (mode & 0100) ? 0777 : 0666;\n+\telse if (S_ISLNK(mode))\n+\t\tmode |= 0777;\n \tsprintf(&header[100], \"%07o\", mode & 07777);\n \n \t/* XXX: should we provide more meaningful info here? */\n@@ -391,7 +393,7 @@ int main(int argc, char **argv)\n \t\tusage(tar_tree_usage);\n \t}\n \n-\tcommit = lookup_commit_reference(sha1);\n+\tcommit = lookup_commit_reference_gently(sha1, 1);\n \tif (commit) {\n \t\twrite_global_extended_header(commit->object.sha1);\n \t\tarchive_time = commit->date;\n-- \n1.2.4.gfe04\n"}]}