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

Function parseBranchConfig

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

Source from the content-addressed store, hash-verified

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