Search code examples
gitcygwinmsys2

git submodules - cygwin vs msys2 - old mode/new mode


In MSYS2, git status shows a bunch of files modified but in Cygwin, nothing modified.

In both, I run the command:
$ git reset --hard && git submodule foreach --recursive git reset --hard && git submodule update --init --recursive

In MSYS2, I see this

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
        modified:   doc/html/images/next_disabled.png
        modified:   doc/html/images/prev_disabled.png
        modified:   doc/html/images/up_disabled.png

And a diff shows

$ git diff doc/html/images/next_disabled.png
diff --git a/doc/html/images/next_disabled.png b/doc/html/images/next_disabled.png
old mode 100755
new mode 100644

But in Cygwin, git status shows no modifications

QUESTION
Why does MSYS2 show a difference?
And what is the "mode"?

UPDATE
I did git config core.fileMode false but that only helped with the non-submodules.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
        modified:   libs/asio (modified content)
        modified:   libs/beast (modified content)
        modified:   libs/config (modified content)
        modified:   libs/convert (modified content)
        modified:   libs/date_time (modified content)
        modified:   libs/function (modified content)
        modified:   libs/gil (modified content)
        modified:   libs/histogram (modified content)
        modified:   libs/iterator (modified content)
        modified:   libs/json (modified content)
        modified:   libs/leaf (modified content)
        modified:   libs/local_function (modified content)
        modified:   libs/math (modified content)
        modified:   libs/mpl (modified content)
        modified:   libs/multiprecision (modified content)
        modified:   libs/mysql (modified content)
        modified:   libs/nowide (modified content)
        modified:   libs/pfr (modified content)
        modified:   libs/pool (modified content)
        modified:   libs/process (modified content)
        modified:   libs/program_options (modified content)
        modified:   libs/python (modified content)
        modified:   libs/safe_numerics (modified content)
        modified:   libs/serialization (modified content)
        modified:   libs/sort (modified content)
        modified:   libs/stl_interfaces (modified content)
        modified:   libs/url (modified content)
        modified:   tools/boost_install (modified content)
        modified:   tools/boostdep (modified content)
        modified:   tools/build (modified content)
        modified:   tools/docca (modified content)
        modified:   **tools/quickbook** (modified content)

MSYS /c/work/misc/boost/boost-repo
$ git diff tools/quickbook/extra/katepart/install.sh

MSYS /c/work/misc/boost/boost-repo
$ cd tools/quickbook/

MSYS /c/work/misc/boost/boost-repo/tools/quickbook
$ git diff extra/katepart/install.sh
diff --git a/extra/katepart/install.sh b/extra/katepart/install.sh
old mode 100644
new mode 100755

Solution

  • You can set the value globally:

    git config --global core.fileMode false
    

    so it will be applied to all current and future repositories; it will be applied to all submodules because submodules are repositories on their own.

    Or you can set the value for the current repository and all current submodules:

    git config core.fileMode false
    git submodules foreach git config core.fileMode false
    

    If you'll add a new submodule in the future you'll need to set the value for the new submodule:

    cd new_submodule_dir
    git config core.fileMode false
    

    Or simply run git submodules foreach git config core.fileMode false once more.