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

Method PushDefault

git/client.go:532–545  ·  view source on GitHub ↗

PushDefault returns the value of push.default in the config. If the value is not set, it returns "simple" (the default git value). See https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault

(ctx context.Context)

Source from the content-addressed store, hash-verified

530// is not set, it returns "simple" (the default git value). See
531// https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault
532func (c *Client) PushDefault(ctx context.Context) (PushDefault, error) {
533 pushDefault, err := c.Config(ctx, "push.default")
534 if err == nil {
535 return ParsePushDefault(pushDefault)
536 }
537
538 // If there is an error that the config key is not set, return the default value
539 // that git uses since 2.0.
540 var gitError *GitError
541 if ok := errors.As(err, &gitError); ok && gitError.ExitCode == 1 {
542 return PushDefaultSimple, nil
543 }
544 return "", err
545}
546
547// RemotePushDefault returns the value of remote.pushDefault in the config. If
548// the value is not set, it returns an empty string.

Callers

nothing calls this directly

Calls 2

ConfigMethod · 0.95
ParsePushDefaultFunction · 0.85

Tested by

no test coverage detected