Git repo versions inside another git repository
I am working on developing some small software that works with git repos and I would like to be able to write some tests. To do this, I created a folder test-repo
inside my project, which itself is a git repository. In my tests, I reference this repository to ensure that the commands I run against the repository are in a known state.
My question is, can I version the embedded repo as part of the main repo of the project? Please note that this is not the same problem as submodules. Solution: The nested repo is indeed part of the attached project, not part of the software referenced by the external link.
source to share
I think the problem is that git is detecting its own files .git
and won't let you work with them. If, however, you renamed your test repo .git
to a different one. _git
it will work. Only one thing you need to do is use the GIT_DIR variable or --git-dir
command line argument in tests to specify the folder.
source to share
Even though this is not an "external referenced software product", submodules are still a good approach as they help capture the known state of the repositories.
I'd like to place repo
, and test-repo
in the parent repo " project
":
project
repo
rest-repo
Thus, I can record the exact SHA1 like repo
and test-repo
.
source to share