Skip to content

Commit 61ba722

Browse files
committed
Silence useless warning when git repo not found
1 parent f4f2163 commit 61ba722

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

setuptools_scm/git_file_finder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
def _git_toplevel(path):
77
try:
8-
out = subprocess.check_output([
9-
'git', 'rev-parse', '--show-toplevel',
10-
], cwd=(path or '.'), universal_newlines=True)
8+
with open(os.devnull, 'wb') as devnull:
9+
out = subprocess.check_output([
10+
'git', 'rev-parse', '--show-toplevel',
11+
], cwd=(path or '.'), universal_newlines=True, stderr=devnull)
1112
return os.path.normcase(os.path.realpath(out.strip()))
1213
except subprocess.CalledProcessError:
1314
# git returned error, we are not in a git repo

0 commit comments

Comments
 (0)