| 510 | ) |
| 511 | |
| 512 | func ParsePushDefault(s string) (PushDefault, error) { |
| 513 | validPushDefaults := map[string]struct{}{ |
| 514 | string(PushDefaultNothing): {}, |
| 515 | string(PushDefaultCurrent): {}, |
| 516 | string(PushDefaultUpstream): {}, |
| 517 | string(PushDefaultTracking): {}, |
| 518 | string(PushDefaultSimple): {}, |
| 519 | string(PushDefaultMatching): {}, |
| 520 | } |
| 521 | |
| 522 | if _, ok := validPushDefaults[s]; ok { |
| 523 | return PushDefault(s), nil |
| 524 | } |
| 525 | |
| 526 | return "", fmt.Errorf("unknown push.default value: %s", s) |
| 527 | } |
| 528 | |
| 529 | // PushDefault returns the value of push.default in the config. If the value |
| 530 | // is not set, it returns "simple" (the default git value). See |