MCPcopy
hub / github.com/cli/cli / PushDefault

Method PushDefault

git/client.go:476–489  ·  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

474// is not set, it returns "simple" (the default git value). See
475// https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault
476func (c *Client) PushDefault(ctx context.Context) (PushDefault, error) {
477 pushDefault, err := c.Config(ctx, "push.default")
478 if err == nil {
479 return ParsePushDefault(pushDefault)
480 }
481
482 // If there is an error that the config key is not set, return the default value
483 // that git uses since 2.0.
484 var gitError *GitError
485 if ok := errors.As(err, &gitError); ok && gitError.ExitCode == 1 {
486 return PushDefaultSimple, nil
487 }
488 return "", err
489}
490
491// RemotePushDefault returns the value of remote.pushDefault in the config. If
492// the value is not set, it returns an empty string.

Callers 1

TestClientPushDefaultFunction · 0.95

Calls 2

ConfigMethod · 0.95
ParsePushDefaultFunction · 0.85

Tested by 1

TestClientPushDefaultFunction · 0.76