| 454 | ) |
| 455 | |
| 456 | func ParsePushDefault(s string) (PushDefault, error) { |
| 457 | validPushDefaults := map[string]struct{}{ |
| 458 | string(PushDefaultNothing): {}, |
| 459 | string(PushDefaultCurrent): {}, |
| 460 | string(PushDefaultUpstream): {}, |
| 461 | string(PushDefaultTracking): {}, |
| 462 | string(PushDefaultSimple): {}, |
| 463 | string(PushDefaultMatching): {}, |
| 464 | } |
| 465 | |
| 466 | if _, ok := validPushDefaults[s]; ok { |
| 467 | return PushDefault(s), nil |
| 468 | } |
| 469 | |
| 470 | return "", fmt.Errorf("unknown push.default value: %s", s) |
| 471 | } |
| 472 | |
| 473 | // PushDefault returns the value of push.default in the config. If the value |
| 474 | // is not set, it returns "simple" (the default git value). See |