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