Skip to contentSkip to conversation

ignoring file modes completely

DISCUSSION Rafael Kitover 5 participants 10 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The reason for this is that I'm trying to use msysGit with Cygwin git, sometimes to work with an msysGit clone in cygwin or to work with a Cygwin git clone in msysGit. For example, I would like to use "git cpan-init" under Cygwin, then use msysGit to work with the repository, this is currently impossible.

Here is "git status" on a repo made with Cygwin git under msysGit:

$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   Makefile.PL
#       modified:   t/02ads.t
#       modified:   t/02cxn.t
#       modified:   t/04os.t
...
...

Every file is modified because the modes do not match :(

Would it be possible to add some sort of option to ignore all file mode changes?

#1 lore raw
Quoted 5 lines · Rafael Kitover

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

#2 lore raw
Quoted 10 lines · Jared Hance
Quoted 5 lines · Rafael Kitover

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

$ git config --global core.filemode
false

Output of "git diff HEAD" :

Makefile.PL +0 -0
old mode 100755
new mode 100644
t/02ads.t +0 -0
old mode 100755
new mode 100644
t/02cxn.t +0 -0
old mode 100755
new mode 100644
t/04os.t +0 -0
old mode 100755
new mode 100644

...
...

#3 lore raw

t/04os.t

Quoted 28 lines · Rafael Kitover
Quoted 10 lines · Jared Hance
Quoted 5 lines · Rafael Kitover

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

$ git config --global core.filemode
false

Output of "git diff HEAD" :

Makefile.PL +0 -0
old mode 100755
new mode 100644
t/02ads.t +0 -0
old mode 100755
new mode 100644
t/02cxn.t +0 -0
old mode 100755
new mode 100644
t/04os.t +0 -0
old mode 100755
new mode 100644

Those are all executable bit diffs.

Signature · 7 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
#4 lore raw
Quoted 17 lines · Andreas Ericsson
Quoted 16 lines · Rafael Kitover
Quoted 10 lines · Jared Hance
Quoted 5 lines · Rafael Kitover

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

$ git config --global core.filemode
false

Output of "git diff HEAD" :

Quoted 15 lines

t/04os.t

Quoted 12 lines
Makefile.PL +0 -0
old mode 100755
new mode 100644
t/02ads.t +0 -0
old mode 100755
new mode 100644
t/02cxn.t +0 -0
old mode 100755
new mode 100644
t/04os.t +0 -0
old mode 100755
new mode 100644

Those are all executable bit diffs.

Ok, but I have core.filemode set to "false" as I showed, why does this happen then?

#5 lore raw

Rafael Kitover venit, vidit, dixit 05.02.2011 20:28:

Quoted 34 lines · Andreas Ericsson
Quoted 17 lines · Rafael Kitover
Quoted 16 lines · Jared Hance
Quoted 10 lines · Rafael Kitover
Quoted 5 lines

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

$ git config --global core.filemode
false

Output of "git diff HEAD" :

Quoted 15 lines

t/04os.t

Quoted 12 lines
Makefile.PL +0 -0
old mode 100755
new mode 100644
t/02ads.t +0 -0
old mode 100755
new mode 100644
t/02cxn.t +0 -0
old mode 100755
new mode 100644
t/04os.t +0 -0
old mode 100755
new mode 100644

Those are all executable bit diffs.

Quoted 2 lines

Ok, but I have core.filemode set to "false" as I showed, why does this happen then?

I can't confirm this on linux with current git. What are your versions? Do you have a minimal example (starting from git init)?

Michael

BTW: Leaving out helpful folks from cc does not help... I should not have to re-add them by hand.

#6 lore raw
Quoted 35 lines · Michael J Gruber

Rafael Kitover venit, vidit, dixit 05.02.2011 20:28:

Quoted 34 lines · Andreas Ericsson
Quoted 32 lines · Rafael Kitover

t/04os.t

Quoted 28 lines · Jared Hance
Quoted 10 lines · Rafael Kitover
Quoted 5 lines

Hello,

I found the core.filemode option, which ignores executable bits, but I need an option to ignore all mode differences, and such an option does not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

$ git config --global core.filemode
false

Output of "git diff HEAD" :

Makefile.PL +0 -0
old mode 100755
new mode 100644
t/02ads.t +0 -0
old mode 100755
new mode 100644
t/02cxn.t +0 -0
old mode 100755
new mode 100644
t/04os.t +0 -0
old mode 100755
new mode 100644

Those are all executable bit diffs.

Quoted 5 lines
Quoted 2 lines

Ok, but I have core.filemode set to "false" as I showed, why does this happen then?

I can't confirm this on linux with current git. What are your versions? Do you have a minimal example (starting from git init)?

This is msysGit:

$ git --version
git version 1.7.3.1

I can't replicate this with just "git init" and a file, it seems to happen when I use "git cpan-init" in Cygwin then look at the repo in msysGit.

#7 lore raw
Quoted 44 lines · Rafael Kitover
Quoted 37 lines · Michael J Gruber

Rafael Kitover venit, vidit, dixit 05.02.2011 20:28:

Quoted 36 lines · Andreas Ericsson
Quoted 34 lines · Rafael Kitover

t/04os.t

Quoted 30 lines · Jared Hance
Quoted 12 lines · Rafael Kitover
Quoted 7 lines

Hello,

I found the core.filemode option, which ignores executable bits, but I
need an option to ignore all mode differences, and such an option does
not seem to exist.

The only mode tracked by Git is the executable bit, so this shouldn't even be an issue. Are you sure the executable bit isn't the problem?

$ git config --global core.filemode
false

Output of "git diff HEAD" :

Makefile.PL +0 -0
old mode 100755
new mode 100644
t/02ads.t +0 -0
old mode 100755
new mode 100644
t/02cxn.t +0 -0
old mode 100755
new mode 100644
t/04os.t +0 -0
old mode 100755
new mode 100644

Those are all executable bit diffs.

Quoted 5 lines
Quoted 2 lines

Ok, but I have core.filemode set to "false" as I showed, why does this happen then?

I can't confirm this on linux with current git. What are your versions? Do you have a minimal example (starting from git init)?

Quoted 8 lines

This is msysGit:

$ git --version
git version 1.7.3.1

I can't replicate this with just "git init" and a file, it seems to happen when I use "git cpan-init" in Cygwin then look at the repo in msysGit.

Actually, I can replicate this in Cygwin git:

$ git --version
git version 1.7.3.3
$ cd ~/src
$ mkdir test-repo
$ cd test-repo
$ git init
$ touch README
$ git add README
$ git commit -a -m'test commit'
$ git diff HEAD
$ chmod +x README
$ git diff HEAD
README +0 -0
old mode 100644
new mode 100755
$ git config --global core.filemode
false

The way the executable bit works seems to be different between Cygwin and msys, but in either case core.filemode seems to not be working properly.

#8 lore raw
Quoted 6 lines · Rafael Kitover
$ git diff HEAD
README +0 -0
old mode 100644
new mode 100755
$ git config --global core.filemode
false

This is because core.filemode is set in the local configuration:

$ git config core.filemode
true

Git automatically detects if chmod(2) is supported on the current file system and sets core.filemode to the corresponding value. Because cygwin emulates chmod(), git sets core.filemode to true.

Dmitry

#9 lore raw
Quoted 9 lines · Dmitry Potapov
Quoted 6 lines · Rafael Kitover
$ git diff HEAD
README +0 -0
old mode 100644
new mode 100755
$ git config --global core.filemode
false

This is because core.filemode is set in the local configuration:

Quoted 6 lines
$ git config core.filemode
true

Git automatically detects if chmod(2) is supported on the current file system and sets core.filemode to the corresponding value. Because cygwin emulates chmod(), git sets core.filemode to true.

That was it! Thank you very much. I can now use msysGit and Cygwin git together, very cool.