Skip to content

Commit 33b3d80

Browse files
committed
BF: Builder failing to sync new git projects
The switch to use check_output meant that when there was no existing git repo in the folder the call `git branch --show-current` returns non-zero but with check_output that causes an error to be raised. We don't want that - we want to know it happened and move on.
1 parent 485d29c commit 33b3d80

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

psychopy/projects/pavlovia.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,13 @@ def getGitRoot(p):
10451045
if not p.is_dir():
10461046
p = p.parent # given a file instead of folder?
10471047

1048-
if 'not a git repository' in subprocess.check_output(["git", "branch", "--show-current"],
1049-
cwd=str(p)).decode('utf-8'):
1048+
proc = subprocess.Popen('git branch --show-current',
1049+
stdout=subprocess.PIPE,
1050+
stderr=subprocess.PIPE,
1051+
cwd=str(p), shell=True,
1052+
universal_newlines=True) # newlines forces stdout to unicode
1053+
stdout, stderr = proc.communicate()
1054+
if 'not a git repository' in (stdout + stderr):
10501055
return None
10511056
else:
10521057
# this should have been possible with git rev-parse --top-level

0 commit comments

Comments
 (0)