{"thread":{"id":"1552","subject":"[PATCH] When copying or renaming, keep the mode, please","startedAt":"2005-08-17T07:01:07Z","lastAt":"2005-08-17T07:32:07Z","messageCount":2,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7427","messageId":"Pine.LNX.4.63.0508170900420.3236@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1552","inReplyTo":null,"subject":"[PATCH] When copying or renaming, keep the mode, please","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-17T07:01:07Z","receivedAt":"2005-08-17T07:01:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Without this patch, git-apply does not retain the mode when renaming or\ncopying files.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n\n apply.c |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\n8dca30668d7077fa9b9157c3685b3ace8598a514\ndiff --git a/apply.c b/apply.c\n--- a/apply.c\n+++ b/apply.c\n@@ -1043,8 +1043,12 @@ static int check_patch(struct patch *pat\n \t\t\treturn error(\"%s: already exists in working directory\", new_name);\n \t\tif (errno != ENOENT)\n \t\t\treturn error(\"%s: %s\", new_name, strerror(errno));\n-\t\tif (!patch->new_mode)\n-\t\t\tpatch->new_mode = S_IFREG | 0644;\n+\t\tif (!patch->new_mode) {\n+\t\t\tif (patch->is_new)\n+\t\t\t\tpatch->new_mode = S_IFREG | 0644;\n+\t\t\telse\n+\t\t\t\tpatch->new_mode = patch->old_mode;\n+\t\t}\n \t}\n \n \tif (new_name && old_name) {\n"},{"id":"7431","messageId":"7v7jel10js.fsf@assigned-by-dhcp.cox.net","threadId":"1552","inReplyTo":"Pine.LNX.4.63.0508170900420.3236@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] When copying or renaming, keep the mode, please","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-17T07:32:07Z","receivedAt":"2005-08-17T07:32:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Good catch.  Thanks.\n"}]}