Hello, I have a git repository with an error in a submodule path in the history. The submodule path is “-f”, which is not allowed. But for some reason, it’s in the history of the git, and I’m trying to find a way to manage it without having to rewrite the full history on the main gitlab (if possible)...
To reproduce this unwanted history:
mkdir test-bad-history
cd test-bad-history
echo "Test git submodule problems" > README.md
git init
git add README.md
git commit --message="Start test"
git submodule add https://github.com/leachim6/hello-world.git
git commit --message="Commit new submodule with correct path"
# the bad part...
git mv hello-world -- -f
git commit --message="Move submodule to an invalid path"
# correct it...
git mv -- -f valid-path
sed -i.bak 's/-f/valid-path/' .gitmodules
git add .gitmodules
git commit --message="Back to a valid path"
After that, even if the git is working correctly, we have a “bad” history if we
check with fsck:
$ git fsck
Checking object directories: 100% (256/256), done.
error in blob 19a97d3b70760c74b780c8134e33f5392292c2e6: gitmodulesPath:
disallowed submodule path: -f
Is it possible to correct it? Must git handle this kind of errors?
Thanks in advance for any help.
--
Olivier Bornet
[email protected]
signature.asc
Description: Message signed with OpenPGP

