git: update gitutil test utilities

- Adds a new GitServeHTTP function to start an http server to serve a
  target git repository.
- Adds a new GitDir helper method to get the path to the .git
  directory
- Updates the GitAdd method to take a variable number of files

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-05-25 13:55:26 +01:00
parent d03e93f6f1
commit 48d7dafbd5
3 changed files with 74 additions and 2 deletions

View File

@ -39,9 +39,10 @@ func GitCheckoutBranch(c *Git, tb testing.TB, name string) {
require.Empty(tb, out)
}
func GitAdd(c *Git, tb testing.TB, file string) {
func GitAdd(c *Git, tb testing.TB, files ...string) {
tb.Helper()
_, err := fakeGit(c, "add", file)
args := append([]string{"add"}, files...)
_, err := fakeGit(c, args...)
require.NoError(tb, err)
}