MCPcopy Create free account
hub / github.com/git/git / branch_exists

Function branch_exists

git-p4.py:1167–1177  ·  view source on GitHub ↗

Make sure that the given ref name really exists.

(branch)

Source from the content-addressed store, hash-verified

1165
1166
1167def branch_exists(branch):
1168 """Make sure that the given ref name really exists."""
1169
1170 cmd = ["git", "rev-parse", "--symbolic", "--verify", branch]
1171 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1172 out, _ = p.communicate()
1173 out = decode_text_stream(out)
1174 if p.returncode:
1175 return False
1176 # expect exactly one line of output: the branch name
1177 return out.rstrip() == branch
1178
1179
1180def findUpstreamBranchPoint(head="HEAD"):

Callers 1

importRevisionsMethod · 0.85

Calls 1

decode_text_streamFunction · 0.85

Tested by

no test coverage detected