{"thread":{"id":"36904","subject":"bug: git merge --no-commit loses track of file modes in the index","startedAt":"2014-06-13T01:38:58Z","lastAt":"2014-06-13T06:26:19Z","messageCount":3,"participants":["Joey Hess","Stefan Haller","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"244049","messageId":"20140613013858.GA28485@kitenet.net","threadId":"36904","inReplyTo":null,"subject":"bug: git merge --no-commit loses track of file modes in the index","fromName":"Joey Hess","fromEmail":"joey@kitenet.net","sentAt":"2014-06-13T01:38:58Z","receivedAt":"2014-06-13T01:38:58Z","isPatch":false,"sender":{"key":"joey@kitenet.net","avatar":"https://avatars.githubusercontent.com/u/16392?v=4"},"body":"If git merge --no-commit is used to merge a commit adding a \nfile with an unusual mode -- specifically a symlink which has \"mode\" 120000,\nit fails to stage the right mode into the index.\n\nThis only happens when core.symlinks=false. I noticed it on FAT, but\nhave managed to reproduce it on ext4.\n\nHere's an example of the bug:\n\njoey@darkstar:~>git clone r1 r2\nCloning into 'r2'...\ndone.\njoey@darkstar:~>cd r1\njoey@darkstar:~/r1>ls -l\ntotal 0\nlrwxrwxrwx 1 joey joey 11 Jun 12 21:23 foo -> /etc/passwd\njoey@darkstar:~/r1>git mv foo bar\njoey@darkstar:~/r1>git commit -m moved\n[master 516a53c] moved\n 1 file changed, 0 insertions(+), 0 deletions(-)\n rename foo => bar (100%)\njoey@darkstar:~/r1>cd ..\njoey@darkstar:~>cd r2\njoey@darkstar:~/r2>git config core.symlinks false\njoey@darkstar:~/r2>git fetch origin\nremote: Counting objects: 2, done.\nremote: Total 2 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (2/2), done.\nFrom /home/joey/r1\n   7ab8102..516a53c  master     -> origin/master\njoey@darkstar:~/r2>git merge origin/master --no-commit --no-ff\nAutomatic merge went well; stopped before committing as requested\njoey@darkstar:~/r2>git diff --cached\ndiff --git a/bar b/bar\nnew file mode 100644\nindex 0000000..3594e94\n--- /dev/null\n+++ b/bar\n@@ -0,0 +1 @@\n+/etc/passwd\n\\ No newline at end of file\ndiff --git a/foo b/foo\ndeleted file mode 120000\nindex 3594e94..0000000\n--- a/foo\n+++ /dev/null\n@@ -1 +0,0 @@\n-/etc/passwd\n\\ No newline at end of file\njoey@darkstar:~/r2>git commit -m oops\n[master 63bd960] oops\njoey@darkstar:~/r2>git show\ncommit 63bd9608c96a91582b27c5853ff58053bab6c71c\nMerge: 7ab8102 516a53c\nAuthor: Joey Hess <joey@kitenet.net>\nDate:   Thu Jun 12 21:37:35 2014 -0400\n\n    oops\n\ndiff --cc bar\nindex 0000000,3594e94..3594e94\nmode 000000,120000..100644\n--- a/bar\n+++ b/bar\n\njoey@darkstar:~/r2>git version\ngit version 2.0.0\n\n-- \nsee shy jo\n"},{"id":"244053","messageId":"1ln65kj.xi5xs1rn4dkiM%lists@haller-berlin.de","threadId":"36904","inReplyTo":"20140613013858.GA28485@kitenet.net","subject":"Re: bug: git merge --no-commit loses track of file modes in the index","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2014-06-13T05:52:19Z","receivedAt":"2014-06-13T05:52:19Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Joey Hess <joey@kitenet.net> wrote:\n\n> If git merge --no-commit is used to merge a commit adding a \n> file with an unusual mode -- specifically a symlink which has \"mode\" 120000,\n> it fails to stage the right mode into the index.\n> \n> This only happens when core.symlinks=false. I noticed it on FAT, but\n> have managed to reproduce it on ext4.\n\nThis sounds familiar; I wonder if it is related to the problem that git\ncan lose the executable bit when core.filemode is false.\n\n   <http://thread.gmane.org/gmane.comp.version-control.git/159716>\n\nI had planned to look into fixing this for years now, as we still run\ninto it once in a while, and it's pretty annoying; but I still didn't\nget around to it yet.\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"244055","messageId":"539A998B.7030200@kdbg.org","threadId":"36904","inReplyTo":"20140613013858.GA28485@kitenet.net","subject":"Re: bug: git merge --no-commit loses track of file modes in the index","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-06-13T06:26:19Z","receivedAt":"2014-06-13T06:26:19Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 13.06.2014 03:38, schrieb Joey Hess:\n> If git merge --no-commit is used to merge a commit adding a\n> file with an unusual mode -- specifically a symlink which has \"mode\" 120000,\n> it fails to stage the right mode into the index.\n>\n> This only happens when core.symlinks=false. I noticed it on FAT, but\n> have managed to reproduce it on ext4.\n\nThere's a similar breakage with core.filemode=false, which loses the x bit \nof files that need a content merge.\n\n-- Hannes\n"}]}