MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / get_default_branch

Function get_default_branch

src/utils/git.py:101–113  ·  view source on GitHub ↗
(cwd: str | None = None)

Source from the content-addressed store, hash-verified

99
100
101def get_default_branch(cwd: str | None = None) -> str:
102 head_ref = _run_git_ok(["symbolic-ref", "refs/remotes/origin/HEAD"], cwd)
103 if head_ref:
104 parts = head_ref.rsplit("/", 1)
105 if len(parts) == 2:
106 return parts[1]
107
108 for candidate in ("main", "master", "develop"):
109 check = _run_git_ok(["rev-parse", "--verify", f"refs/heads/{candidate}"], cwd)
110 if check:
111 return candidate
112
113 return "main"
114
115
116def get_file_status(cwd: str | None = None) -> list[FileStatus]:

Callers 1

test_get_defaultMethod · 0.90

Calls 1

_run_git_okFunction · 0.85

Tested by 1

test_get_defaultMethod · 0.72