Code

[PATCH] Fix git-merge-one-file permissions auto-merging
authorPetr Baudis <pasky@ucw.cz>
Wed, 8 Jun 2005 21:26:55 +0000 (23:26 +0200)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 8 Jun 2005 22:54:45 +0000 (15:54 -0700)
In the automerge case, permissions were not restored properly after the
merge tool was invoked and overwrote the target file.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
git-merge-one-file-script

index 62cbb2a9dc14212b9fb4cb3c42d582406e0b6081..cf42ff63c2dd3b945d07a9a4532f26e253708558 100755 (executable)
@@ -63,10 +63,14 @@ case "${1:-.}${2:-.}${3:-.}" in
        merge -p "$src1" "$orig" "$src2" > "$4"
        ret=$?
        rm -f -- "$orig" "$src1" "$src2"
+
        if [ "$6" != "$7" ]; then
                echo "ERROR: Permissions $5->$6->$7 don't match."
                ret=1
        fi
+       case "$6" in *7??) mode=+x;; *) mode=-x;; esac
+       chmod "$mode" "$4"
+
        if [ $ret -ne 0 ]; then
                # Reset the index to the first branch, making
                # git-diff-file useful