Add utility to create test git repositories

Problem to solve

In our git/git_test.go suite, we heavily rely on stubbing commands with the command stubber. The process is unintuitive, and does not provide a strong safety guarantee, i.e. if we stub no error incorrectly we get a false sense that our command works. Thus, we end up having to do manual tests in addition to the unit tests - a process that does not scale as the project grows.

Proposal

We should be able to create real git repositories and execute commands against the git binary itself. Also, it would be very helpful to have something like we have in the main GitLab monolith with factorybot, e.g. the ability to create repos with different kinds of traits.

Further details

  • A repository can be created from a template using git init --template or GIT_TEMPLATE_DIR=/some/dir/here git init.
  • Project with git repository factory.

Links / references

Assignee Loading
Time tracking Loading