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