MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / New

Function New

git/git.go:264–282  ·  view source on GitHub ↗

New creates a new Command object with the provided options. It applies each option to the config object and initializes the Command object with the configurations.

(opts ...Option)

Source from the content-addressed store, hash-verified

262// New creates a new Command object with the provided options.
263// It applies each option to the config object and initializes the Command object with the configurations.
264func New(opts ...Option) *Command {
265 // Instantiate a new config object with default values
266 cfg := &config{}
267
268 // Loop through each option passed as argument and apply it to the config object
269 for _, o := range opts {
270 o.apply(cfg)
271 }
272
273 // Instantiate a new Command object with the configurations from the config object
274 cmd := &Command{
275 diffUnified: cfg.diffUnified,
276 // Append the user-defined excludeList to the default excludeFromDiff
277 excludeList: append(excludeFromDiff, cfg.excludeList...),
278 isAmend: cfg.isAmend,
279 }
280
281 return cmd
282}

Callers 5

checkFunction · 0.92
hook.goFile · 0.92
review.goFile · 0.92
commit.goFile · 0.92
TestCanExecuteGitDiffFunction · 0.70

Calls 1

applyMethod · 0.65

Tested by 1

TestCanExecuteGitDiffFunction · 0.56