Skip to content

Commit 5e1a969

Browse files
author
Basri Ates
committed
get branch If default 'git git_describe_command' failed
1 parent 99f06c7 commit 5e1a969

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/setuptools_scm/git.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,16 @@ def parse(
107107
out, unused_err, ret = wd.do_ex(describe_command)
108108
if ret:
109109
# If 'git git_describe_command' failed, try to get the information otherwise.
110+
branch, branch_err, branch_ret = wd.do_ex("git symbolic-ref --short HEAD")
111+
112+
if branch_ret:
113+
branch = None
114+
110115
rev_node = wd.node()
111116
dirty = wd.is_dirty()
112117

113118
if rev_node is None:
114-
return meta("0.0", distance=0, dirty=dirty, config=config)
119+
return meta("0.0", distance=0, dirty=dirty, branch=branch, config=config)
115120

116121
return meta(
117122
"0.0",

0 commit comments

Comments
 (0)