| 403 | } |
| 404 | |
| 405 | func parseBranchConfig(branchConfigLines []string) BranchConfig { |
| 406 | var cfg BranchConfig |
| 407 | |
| 408 | // Read the config lines for the specific branch |
| 409 | for _, line := range branchConfigLines { |
| 410 | parts := strings.SplitN(line, " ", 2) |
| 411 | if len(parts) < 2 { |
| 412 | continue |
| 413 | } |
| 414 | keys := strings.Split(parts[0], ".") |
| 415 | switch keys[len(keys)-1] { |
| 416 | case "remote": |
| 417 | cfg.RemoteURL, cfg.RemoteName = parseRemoteURLOrName(parts[1]) |
| 418 | case "pushremote": |
| 419 | cfg.PushRemoteURL, cfg.PushRemoteName = parseRemoteURLOrName(parts[1]) |
| 420 | case "merge": |
| 421 | cfg.MergeRef = parts[1] |
| 422 | case MergeBaseConfig: |
| 423 | cfg.MergeBase = parts[1] |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | return cfg |
| 428 | } |
| 429 | |
| 430 | // SetBranchConfig sets the named value on the given branch. |
| 431 | func (c *Client) SetBranchConfig(ctx context.Context, branch, name, value string) error { |