{"thread":{"id":"40084","subject":"git merge changes file mode from 644 to 755","startedAt":"2015-08-14T12:02:43Z","lastAt":"2015-08-14T14:17:53Z","messageCount":2,"participants":["Dmitry Oksenchuk","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"268037","messageId":"CA+POfmsohJAGVYHM3nHJydoyxe92QFd59eWT_UG+_0fM46SATA@mail.gmail.com","threadId":"40084","inReplyTo":null,"subject":"git merge changes file mode from 644 to 755","fromName":"Dmitry Oksenchuk","fromEmail":"oksenchuk89@gmail.com","sentAt":"2015-08-14T12:02:43Z","receivedAt":"2015-08-14T12:02:43Z","isPatch":false,"sender":{"key":"oksenchuk89@gmail.com","avatar":null},"body":"Hello,\n\nI've noticed strange behavior of git merge on Windows with\ncore.filemode=false (set by default). Git changed mode of some files\nfrom 644 to 755 for unknown reason. One of the files is stdafx.cpp,\nit's absent in the common ancestor, it was added in the first branch\n(master) with mode 644 and it's still absent in the second branch\n(feature). So, git merges the file without conflicts but changes mode\nfrom 644 to 755.\n\nExample with git merge:\n$ git reset --hard 9b90bac - the first branch\n$ git merge-base 9b90bac f41bd44 - the second branch\ne44b025b000fe71cf621b5aadad88e71d209e301 - the common ancestor\n$ git ls-tree 9b90bac stdafx.cpp\n100644 blob 0bf386d4ae494503129921f5b5077a74976c8f91    stdafx.cpp -\n644 in the first branch\n$ git ls-tree e44b025 stdafx.cpp - absent in the common ancestor\n$ git ls-tree f41bd44 stdafx.cpp - absent in the second branch\n$ git merge f41bd44\nAuto-merging stdafx.cpp\n$ git ls-files -s stdafx.cpp\n100755 0bf386d4ae494503129921f5b5077a74976c8f91 0       stdafx.cpp -\n755 after merge\n\nExample with git read-tree:\n$ git reset --hard 9b90bac\n$ git read-tree -m e44b025 9b90bac f41bd44\n$ git ls-files -s stdafx.cpp\n100644 0bf386d4ae494503129921f5b5077a74976c8f91 0       stdafx.cpp -\n644 after read-tree -m\n\nWhy git merge changes mode from 644 to 755? Is it a known issue?\n\nI use git version 1.9.5.msysgit.0. Maybe the issue was fixed in a later version?\n\nRegards,\nDmitry\n"},{"id":"268039","messageId":"55CDF891.4080709@kdbg.org","threadId":"40084","inReplyTo":"CA+POfmsohJAGVYHM3nHJydoyxe92QFd59eWT_UG+_0fM46SATA@mail.gmail.com","subject":"Re: git merge changes file mode from 644 to 755","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2015-08-14T14:17:53Z","receivedAt":"2015-08-14T14:17:53Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 14.08.2015 um 14:02 schrieb Dmitry Oksenchuk:\n> Hello,\n>\n> I've noticed strange behavior of git merge on Windows with\n> core.filemode=false (set by default). Git changed mode of some files\n> from 644 to 755 for unknown reason. One of the files is stdafx.cpp,\n> it's absent in the common ancestor, it was added in the first branch\n> (master) with mode 644 and it's still absent in the second branch\n> (feature). So, git merges the file without conflicts but changes mode\n> from 644 to 755.\n\nI do know the git-merge-recursive does not honor core.filemode. However, \nI am surprised to see a mode change from 644 to 755. I usually observe \nonly mode changes from 755 to 644, but then the case where the file is \nnot present on one branch is uncommon for me.\n\n> Why git merge changes mode from 644 to 755? Is it a known issue?\n\nSo, well, yes, it is known that with git merge mode changes do occur, \nbut no, 644 to 755 is news to me.\n\nThe work-around is to unstage the file and stage it again, e.g. with \ngit-gui and then to amend the merge commit.\n\n-- Hannes\n"}]}