Git repo is dirty as a submodule

The repository is in a state which makes it difficult to work with as a submodule. with every commit and status check, the state of this repo is reported because EXTENSIONS was deleted, but git doesn't completely recognize that it's gone.

To replicate this issue, create a new directory and initialize git.

mkdir test
cd test
git init

Now add the python-mode repo as a submodule and view the status:

git submodule add https://gitlab.com/python-mode-devs/python-mode.git python-mode.el
git status

On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   .gitmodules
	new file:   python-mode.el

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

	modified:   python-mode.el (modified content)

commit and check status again

git commit -m 'initial commit'
git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

	modified:   python-mode.el (modified content)

no changes added to commit (use "git add" and/or "git commit -a")

change into submodule directory and check status:

cd python-mode
git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	deleted:    EXTENSIONS

no changes added to commit (use "git add" and/or "git commit -a")

It looks like at some point the extensions directory was a file. Now that it's a path, git is confused.

To fix:

git add EXTENSIONS
git commit -m 'cleaned up dirty EXTENSIONS delete`
git push ...

In the mean time, anyone wanting to add this as a submodule can workaround the issue by adding ignore = dirty to the submodule configuration in .git/config

[submodule "dependencies/python-mode"]
	url = https://gitlab.com/python-mode-devs/python-mode.git
	ignore = dirty

I don't believe I can submit a change like this as a merge request.

Edited by Steve Kallestad