{"thread":{"id":"43115","subject":"Re: filemode=false somewhat broken","startedAt":"2006-11-22T20:02:20Z","lastAt":"2006-11-25T06:10:34Z","messageCount":3,"participants":["Shawn Pearce","Juergen Ruehle","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"295372","messageId":"17764.44236.473000.729015@lapjr.intranet.kiel.bmiag.de","threadId":"43115","inReplyTo":null,"subject":"filemode=false somewhat broken","fromName":"Juergen Ruehle","fromEmail":"j.ruehle@bmiag.de","sentAt":"2006-11-22T20:02:20Z","receivedAt":"2006-11-22T20:02:20Z","isPatch":false,"sender":{"key":"j.ruehle@bmiag.de","avatar":null},"body":"Commit fd28b34afd9bbd58297a25edced3f504c9a5487a tried to ignore the\nexecutable bit if filemode=false, but instead forced all files to be\nregular with 644 permission bits nuking symlink support. The attached\ndiff works better for me, but note that I'm completely posix agnostic.\n\nUnfortunately there still seems to be another problem somewhere: files\nmerged by octopus (wanted to try one, too, after the recent\ndiscussions on the list:-) lose the x bits in the process. But as\nusual I'm not smart enough to find the problem:-(\n\ndiff --git a/builtin-update-index.c b/builtin-update-index.c\nindex 7f9c638..f4b4bc4 100644\n--- a/builtin-update-index.c\n+++ b/builtin-update-index.c\n@@ -112,13 +112,13 @@ static int add_file_to_cache(const char\n \tce->ce_mode = create_ce_mode(st.st_mode);\n \tif (!trust_executable_bit) {\n \t\t/* If there is an existing entry, pick the mode bits\n-\t\t * from it, otherwise force to 644.\n+\t\t * from it, otherwise use mask 666.\n \t\t */\n \t\tint pos = cache_name_pos(path, namelen);\n \t\tif (0 <= pos)\n \t\t\tce->ce_mode = active_cache[pos]->ce_mode;\n \t\telse\n-\t\t\tce->ce_mode = create_ce_mode(S_IFREG | 0644);\n+\t\t\tce->ce_mode = create_ce_mode((S_IFMT | 0666) & st.st_mode);\n \t}\n \n \tif (index_path(ce->sha1, path, &st, !info_only))\ndiff --git a/read-cache.c b/read-cache.c\nindex 97c3867..6cbbecf 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -347,13 +347,13 @@ int add_file_to_index(const char *path,\n \tce->ce_mode = create_ce_mode(st.st_mode);\n \tif (!trust_executable_bit) {\n \t\t/* If there is an existing entry, pick the mode bits\n-\t\t * from it, otherwise force to 644.\n+\t\t * from it, otherwise use mask 666.\n \t\t */\n \t\tint pos = cache_name_pos(path, namelen);\n \t\tif (pos >= 0)\n \t\t\tce->ce_mode = active_cache[pos]->ce_mode;\n \t\telse\n-\t\t\tce->ce_mode = create_ce_mode(S_IFREG | 0644);\n+\t\t\tce->ce_mode = create_ce_mode((S_IFMT | 0666) & st.st_mode);\n \t}\n \n \tif (index_path(ce->sha1, path, &st, 1))\n-- \n1.4.4.g540c\n\n"},{"id":"296016","messageId":"7vodqzp0mh.fsf@assigned-by-dhcp.cox.net","threadId":"43115","inReplyTo":"17764.44236.473000.729015@lapjr.intranet.kiel.bmiag.de","subject":"Re: filemode=false somewhat broken","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-22T22:39:18Z","receivedAt":"2006-11-22T22:39:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Juergen Ruehle <j.ruehle@bmiag.de> writes:\n\n> Commit fd28b34afd9bbd58297a25edced3f504c9a5487a tried to ignore the\n> executable bit if filemode=false, but instead forced all files to be\n> regular with 644 permission bits nuking symlink support.\n\nThanks for noticing.  Yes, that change is _seriously_ broken.  I\nshould really raise the bar for patch acceptance.\n\n\n"},{"id":"293865","messageId":"20061125061034.GA4528@spearce.org","threadId":"43115","inReplyTo":"7vodqzp0mh.fsf@assigned-by-dhcp.cox.net","subject":"Re: filemode=false somewhat broken","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-11-25T06:10:34Z","receivedAt":"2006-11-25T06:10:34Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Juergen Ruehle <j.ruehle@bmiag.de> writes:\n> \n> > Commit fd28b34afd9bbd58297a25edced3f504c9a5487a tried to ignore the\n> > executable bit if filemode=false, but instead forced all files to be\n> > regular with 644 permission bits nuking symlink support.\n> \n> Thanks for noticing.  Yes, that change is _seriously_ broken.  I\n> should really raise the bar for patch acceptance.\n\nWhoops.\n\nI don't work with symlinks so I never noticed the breakage myself.\nClearly the test cases that I created in fd28b3 should also have\nincluded symlinks, but they did not...  and we see this breakage\noccur.\n\n-- \n"}]}