RemotePushDefault returns the value of remote.pushDefault in the config. If the value is not set, it returns an empty string.
(ctx context.Context)
| 553 | // RemotePushDefault returns the value of remote.pushDefault in the config. If |
| 554 | // the value is not set, it returns an empty string. |
| 555 | func (c *Client) RemotePushDefault(ctx context.Context) (string, error) { |
| 556 | remotePushDefault, err := c.Config(ctx, "remote.pushDefault") |
| 557 | if err == nil { |
| 558 | return remotePushDefault, nil |
| 559 | } |
| 560 | |
| 561 | var gitError *GitError |
| 562 | if ok := errors.As(err, &gitError); ok && gitError.ExitCode == 1 { |
| 563 | return "", nil |
| 564 | } |
| 565 | |
| 566 | return "", err |
| 567 | } |
| 568 | |
| 569 | // RemoteTrackingRef is the structured form of the string "refs/remotes/<remote>/<branch>". |
| 570 | // For example, the @{push} revision syntax could report "refs/remotes/origin/main" which would |