Search code examples
gitgit-submodules

Submodule is always modified even after hard resets


My submodule shows as having been modified (I did not touch anything there). I have been trying to hard reset it to no avail:

~dom/gitmodules/emacswiki heads/master*
❯ git reset --hard upstream/master                                                                         141
HEAD is now at f54d96c32 How to grant GNU Emacs for OS X full disk access

~dom/gitmodules/emacswiki heads/master*
❯ git status -s                              
 M AucTeX
 M AutoLisp
...

I tried doing:

cd ../
git submodule deinit -f .
git submodule update --init
git submodule update -f --recursive

as well, which didn't do anything.


Solution

  • This:

    It's git://github.com/emacsmirror/emacswiki.org.git, and yes, I am on macOS.

    is the key. Cloning that repository on macOS, and checking out some of the commits near f54d96c32, with a reasonably modern Git, but on a case-folding file system (as the default file systems on macOS are), gives a lot of warnings:

    warning: the following paths have collided (e.g. case-sensitive paths
    on a case-insensitive filesystem) and only one from the same
    colliding group is in the working tree:
    
      'Anything'
      'anything'
      'Artagnon'
      'artagnon'
      'AUCTeX'
      'AucTeX'
      'AutoLISP'
      'AutoLisp'
      'BookMarks'
      'Bookmarks'
    

    [many more snipped]

    Checking out commit f54d96c32 on a case-sensitive file system, we can, for instance, compare the two files AutoLISP vs AutoLisp:

    $ file AutoLISP AutoLisp
    AutoLISP: ASCII text
    AutoLisp: ASCII text, with very long lines
    $ cat AutoLISP
    #REDIRECT AutoLisp
    $ cat AutoLisp
    AutoLisp is the API for the proprietary computer-aided design system, !AutoCAD. [snip]
    

    To check this out correctly and easily on a Mac you will need to work in a case-sensitive file system. See, e.g., my answer to How do I change case of the names of multiple files, already committed?