MCPcopy Create free account
hub / github.com/cli/cli / TestWithRepoDirInsertsRepositoryBeforeGitArguments

Function TestWithRepoDirInsertsRepositoryBeforeGitArguments

git/command_test.go:66–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func 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
77func TestWithRepoDirReplacesExistingRepository(t *testing.T) {
78 // Given a Git command already scoped to a repository

Callers

nothing calls this directly

Calls 3

WithRepoDirFunction · 0.85
CommandMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected