I am working on developing a little piece of software that works with git repositories, and I would like to be able to write some tests. In order to do so, I created a test-repo folder inside my project that itself is a git repository. In my tests I reference that repository to ensure that the commands I run against a repository in precisely known state.
My question is: Can I version that nested repo as part of the main repo of the project? Please note this is not really the same problem that submodules solve: The nested repo is really part of the enclosing project, not an externally referenced piece of software.
I think the problem is that git detects its own
.gitfiles and doesn’t allow to work with them. If you however rename your test repo’s.gitfolder to something different, e.g._gitit will work. Only one thing you need to do is to use GIT_DIR variable or--git-dircommand line argument in your tests to specify the folder.