{"thread":{"id":"867","subject":"[PATCH] Fix git-merge-one-file permissions auto-merging","startedAt":"2005-06-08T21:26:55Z","lastAt":"2005-06-08T21:26:55Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4727","messageId":"20050608212655.GQ982@pasky.ji.cz","threadId":"867","inReplyTo":null,"subject":"[PATCH] Fix git-merge-one-file permissions auto-merging","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-08T21:26:55Z","receivedAt":"2005-06-08T21:26:55Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"In the automerge case, permissions were not restored properly after the\nmerge tool was invoked and overwrote the target file.\n\nSigned-off-by: Petr Baudis <pasky@ucw.cz>\n\n---\ncommit d0a0933d6ed6190a767f6baad6c93aa79b3901b2\ntree 0a278964e7cd15b2f35b00551747c4908d65b244\nparent 9d6694e94c2ff7fc24ecb4124234cef6c6037ad5\nauthor Petr Baudis <pasky@ucw.cz> Wed, 08 Jun 2005 23:26:23 +0200\ncommitter Petr Baudis <xpasky@machine.sinus.cz> Wed, 08 Jun 2005 23:26:23 +0200\n\n git-merge-one-file-script |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-merge-one-file-script b/git-merge-one-file-script\n--- a/git-merge-one-file-script\n+++ b/git-merge-one-file-script\n@@ -63,10 +63,14 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n \tmerge -p \"$src1\" \"$orig\" \"$src2\" > \"$4\"\n \tret=$?\n \trm -f -- \"$orig\" \"$src1\" \"$src2\"\n+\n \tif [ \"$6\" != \"$7\" ]; then\n \t\techo \"ERROR: Permissions $5->$6->$7 don't match.\"\n \t\tret=1\n \tfi\n+\tcase \"$6\" in *7??) mode=+x;; *) mode=-x;; esac\n+\tchmod \"$mode\" \"$4\"\n+\n \tif [ $ret -ne 0 ]; then\n \t\t# Reset the index to the first branch, making\n \t\t# git-diff-file useful\n\n|\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n<Espy> be careful, some twit might quote you out of context..\n"}]}