barrywardell / git-module

A tool for simplifying the management of git submodules
GNU Lesser General Public License v2.1
2 stars 0 forks source link

git-module sync does not fully remove submodules #6

Open ianhinder opened 12 years ago

ianhinder commented 12 years ago

If I remove submodules from .gitmodules and then do a git module sync, I cannot commit the result:

vpn-external-022:Kerrness (master) $ git status

On branch master

Changes to be committed:

(use "git reset HEAD ..." to unstage)

modified: .gitmodules

deleted: arrangements/AEIDevelopment/IsolatedHorizon

vpn-external-022:Kerrness (master) $ git commit .gitmodules arrangements repos error: unable to index file arrangements/AEIDevelopment/IsolatedHorizon fatal: updating files failed

vpn-external-022:Kerrness (master) $ rmdir arrangements/AEIDevelopment/IsolatedHorizon vpn-external-022:Kerrness (master) $ git commit .gitmodules arrangements repos error: unable to index file arrangements/CactusTest/TestArrays fatal: updating files failed

so it looks like a good idea for git module sync to also remove the directories (they are empty, because I never "update"d them).

barrywardell commented 12 years ago

Right now, 'git module sync' does the same as 'git module rm' for all removed submodules. This removes the directory from the index using the --cached option so that the directory is not actually deleted.

Note also that the .gitmodules file and removed directory are also staged so you should be able to commit without specifying the paths explicitly. Does it work for you if you do this?

ianhinder commented 12 years ago

My problem was that I also had another change in the index that I didn't want to commit at that time. So you are saying that I could have just committed the index using "git commit" and it should have worked even if the directories were still in the work tree? Actually, I'm not sure I understand why I wasn't able to "git commit

" in this case.

ianhinder commented 12 years ago

That should read: why I wasn't able to "git commit dir" in this case.