| 65 | } |
| 66 | |
| 67 | func (gc *Command) setRepoDir(repoDir string) { |
| 68 | for i, arg := range gc.Args { |
| 69 | if arg == "-C" { |
| 70 | gc.Args[i+1] = repoDir |
| 71 | return |
| 72 | } |
| 73 | } |
| 74 | // Handle "--" invocations for testing purposes. |
| 75 | var index int |
| 76 | for i, arg := range gc.Args { |
| 77 | if arg == "--" { |
| 78 | index = i + 1 |
| 79 | } |
| 80 | } |
| 81 | gc.Args = append(gc.Args[:index+3], gc.Args[index+1:]...) |
| 82 | gc.Args[index+1] = "-C" |
| 83 | gc.Args[index+2] = repoDir |
| 84 | } |
| 85 | |
| 86 | // Allow individual commands to be modified from the default client options. |
| 87 | type CommandModifier func(*Command) |