MCPcopy Create free account
hub / github.com/cli/cli / parseBranchConfig

Function parseBranchConfig

git/client.go:467–490  ·  view source on GitHub ↗
(branchConfigLines []string)

Source from the content-addressed store, hash-verified

465}
466
467func 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.
493func (c *Client) SetBranchConfig(ctx context.Context, branch, name, value string) error {

Callers 2

Test_parseBranchConfigFunction · 0.85
ReadBranchConfigMethod · 0.85

Calls 1

parseRemoteURLOrNameFunction · 0.85

Tested by 1

Test_parseBranchConfigFunction · 0.68