(t *testing.T)
| 64 | } |
| 65 | |
| 66 | func TestWithRepoDirInsertsRepositoryBeforeGitArguments(t *testing.T) { |
| 67 | // Given a Git command with a final -C operand after the argument separator |
| 68 | command := &Command{exec.Command("git", "rev-parse", "--", "-C")} |
| 69 | |
| 70 | // When its repository directory is changed |
| 71 | WithRepoDir("path/to/repo")(command) |
| 72 | |
| 73 | // Then the repository option is inserted before the Git subcommand without moving the separator |
| 74 | assert.Equal(t, []string{"git", "-C", "path/to/repo", "rev-parse", "--", "-C"}, command.Args) |
| 75 | } |
| 76 | |
| 77 | func TestWithRepoDirReplacesExistingRepository(t *testing.T) { |
| 78 | // Given a Git command already scoped to a repository |
nothing calls this directly
no test coverage detected