Вопрос

In an effort to debug a problem in a third party library, I copied their source into my own git repo. I reproduced the problem immediately so wanted to commit to record a starting point. When I attempted to commit, none of the files I had copied were showing up in my working tree, so I couldn't stage them.

I tried explicitly staging one of the files in the copied source:

git add README 
fatal: Path 'Src/Foo/README' is in submodule 'Src/Foo/FooBar'

So it seems git thinks it's a submodule, even though I never told it that it was. I tried deleting the .git directory in the root of the third party source, but that didn't help. Then I tried following these instructions, but it tells me I have no submodules:

git submodule deinit .
No submodule mapping found in .gitmodules for path 'Src/Foo/FooBar'

Any ideas?

Это было полезно?

Решение

The simplest solution is to clone that third-party repo, reproduces your fix, commit and push (if you have access to their repo, you if you have forked it on GitHub)

If not, do (in a fresh clone of your repo) a:

git ls-tree HEAD Src/Foo/FooBar

See if there is an special entry 160000, which would indicate that FooBar was registered as a submodule at one point in time) even if the .gitmodules doesn't list FooBar anymore.

A git rm --cached Src/Foo/FooBar (with git 1.8.5+) would take care of that submodule entry.


Of course, if the thirdparty sources are not part of a git repo, then adding them in a different folder within your own repo would work too.
But the history of those third-party library files would become mixed with the history of your main repo.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top