10
4
Under Ubuntu and Debian the last committed files are getting the execution bit set, when I try a checkout afterwards. It's quite strange and driving me nuts:
$ ls -l file
-rw-r--r-- ... file
# on branch master:
$ git commit -m 'mode is 644' file
[master 0123456] mode is 644
1 files changed, 1 insertions(+), 1 deletions(-)
# All ok
$ git checkout dev-branch
Switched to branch 'dev-branch'
# Seemingly all ok, but file now has the exec bit set
$ git merge master
Updating 6543210..0123456
error: Your local changes to 'file' would be overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.
# Oops...
$ ls -l file
-rwxr-xr-x ... file
Has anyone an idea, when and why the execution bit slips in? core.filemode
is set to true
.
I have the file open in vim during the branch switching, if that's important somehow.
Addendum 1: It's the checkout, where the permissions are screwed up. I can play the game on and on:
$ git br
* master
dev-branch
$ git diff
diff --git a/file b/file
old mode 100644
new mode 100755
$ chmod 644 file
$ git diff
$ git checkout dev-branch
$ git diff
diff --git a/file b/file
old mode 100644
new mode 100755
$ chmod 644 file
$ git diff
$ git checkout master
$ git diff
diff --git a/file b/file
old mode 100644
new mode 100755
# ...and so on ad inf.
Addendum 2: This happens, by the way, for every file in this repository, that I commit. After the successful commit I can't switch branches without the permission screw-up.
Have you checked the permissions at the #seemingly all ok step... – RobotHumans – 2010-11-05T06:29:32.487
I agree here. On dev-branch, 'git-log master...HEAD -- file' and see if anything has changed between the branch and now on that file. – yuriismaster – 2010-11-05T08:50:29.913
@aking1012: Yes, at that point the file modes already changed. I'll update the question. – Boldewyn – 2010-11-05T09:49:30.680
@yuriismaster:
git-log
shows no output at all, for neither combination ofmaster
,dev-branch
orHEAD
(which is strange, isn't it? Shouldn't the command print the last commit message frommaster
?) – Boldewyn – 2010-11-05T09:52:53.983@Boldewyn that is quite odd... it looks like the file is always being set back to executable on checkout. Unless something is scripted-ly setting the ex flag, it maybe be an oddity in the index. Is there something in gitignore? I don't know if playing around with git-update-index will help (see ref at http://justaddwater.dk/2009/12/07/how-to-make-git-ignore-files-that-already-exist-in-your-project/ )
– yuriismaster – 2010-11-06T04:16:46.267@yuriismaster: Yes, there is content in my
.gitignore
, but it is different from where the above problem occurs (in all branches). I didn't useupdate-index
on this repository yet (I did it with anotzer on the same machines with--assume-unchanged
, but that repository doesn't show this behaviour). – Boldewyn – 2010-11-06T13:05:45.2332What filesystem are you on? – bitmask – 2010-11-07T22:20:04.223
@bitmask I have the same issue, also on Ubuntu. My filesystem is "cifs" with flags "rw". – dolmen – 2012-08-10T08:10:13.597