(callerArgs ...string)
| 85 | } |
| 86 | |
| 87 | func (repo *Repository) GitCommand(callerArgs ...string) *exec.Cmd { |
| 88 | args := []string{ |
| 89 | // Disable replace references when running our commands: |
| 90 | "--no-replace-objects", |
| 91 | |
| 92 | // Disable the warning that grafts are deprecated, since we |
| 93 | // want to set the grafts file to `/dev/null` below (to |
| 94 | // disable grafts even where they are supported): |
| 95 | "-c", "advice.graftFileDeprecated=false", |
| 96 | } |
| 97 | |
| 98 | args = append(args, callerArgs...) |
| 99 | |
| 100 | //nolint:gosec // `gitBin` is chosen carefully, and the rest of |
| 101 | // the args have been checked. |
| 102 | cmd := exec.Command(repo.gitBin, args...) |
| 103 | |
| 104 | cmd.Env = append( |
| 105 | os.Environ(), |
| 106 | "GIT_DIR="+repo.path, |
| 107 | // Disable grafts when running our commands: |
| 108 | "GIT_GRAFT_FILE="+os.DevNull, |
| 109 | ) |
| 110 | |
| 111 | return cmd |
| 112 | } |
| 113 | |
| 114 | // Path returns the path to `repo`. |
| 115 | func (repo *Repository) Path() string { |
no outgoing calls
no test coverage detected