RemotePushDefault returns the value of remote.pushDefault in the config. If the value is not set, it returns an empty string.
(ctx context.Context)
| 491 | // RemotePushDefault returns the value of remote.pushDefault in the config. If |
| 492 | // the value is not set, it returns an empty string. |
| 493 | func (c *Client) RemotePushDefault(ctx context.Context) (string, error) { |
| 494 | remotePushDefault, err := c.Config(ctx, "remote.pushDefault") |
| 495 | if err == nil { |
| 496 | return remotePushDefault, nil |
| 497 | } |
| 498 | |
| 499 | var gitError *GitError |
| 500 | if ok := errors.As(err, &gitError); ok && gitError.ExitCode == 1 { |
| 501 | return "", nil |
| 502 | } |
| 503 | |
| 504 | return "", err |
| 505 | } |
| 506 | |
| 507 | // RemoteTrackingRef is the structured form of the string "refs/remotes/<remote>/<branch>". |
| 508 | // For example, the @{push} revision syntax could report "refs/remotes/origin/main" which would |