git-meta
git-meta copied to clipboard
"git meta status" crashes when submodule entry is missing from tree
Deleting/creating an open submodule is a 5-step process. The error happens when 1 of the 5 is out of sync:
A. the path foo/bar is NOT in the tree of the current commit (nor index);
B. foo/bar IS in the .gitmodules
C. submodule.foo/bar.url IS in the git config
D. the git database at .git/modules/foo/bar IS initialized
E. the working-directory foo/bar IS present and contains a .git pointing to (D)
I don't know exactly what "natural" combination of steps got me into this state, but I was able to recreate it with the following unnatural steps starting from an existing submodule foo/bar:
-
git rm foo/bar -
git commit -m "XXX Partial deletion" foo/bar -
git checkout -b badbranch -
git checkout HEAD~ -
git checkout HEAD .gitmodules -
git meta open foo/bar -
git meta checkout badbranch -
git meta status
Error: the path 'bar' does not exist in the given tree
at Error (native)
A better error message might be something like:
Error: You appear to have a submodule half-initialized at foo/bar . Run `git meta repair` to get back to a consistent state.