MCPcopy
hub / github.com/github/git-sizer / GitCommand

Method GitCommand

git/git.go:87–112  ·  view source on GitHub ↗
(callerArgs ...string)

Source from the content-addressed store, hash-verified

85}
86
87func (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`.
115func (repo *Repository) Path() string {

Callers 7

NewObjectIterMethod · 0.95
GetConfigMethod · 0.95
ConfigStringDefaultMethod · 0.95
ConfigBoolDefaultMethod · 0.95
ConfigIntDefaultMethod · 0.95
NewBatchObjectIterMethod · 0.95
NewReferenceIterMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected