| 465 | } |
| 466 | |
| 467 | func parseBranchConfig(branchConfigLines []string) BranchConfig { |
| 468 | var cfg BranchConfig |
| 469 | |
| 470 | // Read the config lines for the specific branch |
| 471 | for _, line := range branchConfigLines { |
| 472 | parts := strings.SplitN(line, " ", 2) |
| 473 | if len(parts) < 2 { |
| 474 | continue |
| 475 | } |
| 476 | keys := strings.Split(parts[0], ".") |
| 477 | switch keys[len(keys)-1] { |
| 478 | case "remote": |
| 479 | cfg.RemoteURL, cfg.RemoteName = parseRemoteURLOrName(parts[1]) |
| 480 | case "pushremote": |
| 481 | cfg.PushRemoteURL, cfg.PushRemoteName = parseRemoteURLOrName(parts[1]) |
| 482 | case "merge": |
| 483 | cfg.MergeRef = parts[1] |
| 484 | case MergeBaseConfig: |
| 485 | cfg.MergeBase = parts[1] |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | return cfg |
| 490 | } |
| 491 | |
| 492 | // SetBranchConfig sets the named value on the given branch. |
| 493 | func (c *Client) SetBranchConfig(ctx context.Context, branch, name, value string) error { |