I was able to successfully convert submodules into subdirectories using commands such as the methods described in these two examples:
Submodule-> Subdir
Subdir-> Submodule
The challenge is to successfully achieve this in the directory, preserving your history through each conversion .
The two methods described above worked fine on a trivial experimental repository, but did not handle a more complex repository. for example, a repo with an arbitrary commit pattern.
The problem occurs when running
git filter-branch --subdirectory-filter <lib-directory> -- --all
when trying to convert a directory (previously a submodule) to a submodule. If I understand correctly. It darted:
Rewrite c95281d27e4602e9af50146eefcf7c28f5bb4f35 (2/11)a989b207d3757f9803fd50fa2d77908a4dc1330e fatal: failed to unpack tree object c95281d27e4602e9af50146eefcf7c28f5bb4f35:lib/test_submodule Could not initialize the index`
of which there were absolutely no similar results on the Internet.
It was found out that this is due to the repeated reference to the submodule in INDEX, as a result of which, when the submodule was converted, the error above occurred.
Is there a way to do filter-branch that avoids these early submodule references ??
Edit: I looked at this problem again, and I still have not found a way to solve it. Using the Subdir-> Submodule method with git filter-branch works fine for a regular directory; but crash when hit the submodule. The crash that continues to occur in this section in git:
https://github.com/github/git-msysgit/blob/master/git-filter-branch.sh#L300
I canβt interpret this, though.
source share