MCPcopy Index your code
hub / github.com/python/cpython / get_git_branch

Function get_git_branch

Tools/patchcheck/patchcheck.py:43–52  ·  view source on GitHub ↗

Get the symbolic name for the current git branch

()

Source from the content-addressed store, hash-verified

41
42
43def get_git_branch():
44 """Get the symbolic name for the current git branch"""
45 cmd = "git rev-parse --abbrev-ref HEAD".split()
46 try:
47 return subprocess.check_output(cmd,
48 stderr=subprocess.DEVNULL,
49 cwd=SRCDIR,
50 encoding='UTF-8')
51 except subprocess.CalledProcessError:
52 return None
53
54
55def get_git_upstream_remote():

Callers 1

get_base_branchFunction · 0.85

Calls 2

splitMethod · 0.45
check_outputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…