Skip to content

Commit

Permalink
BF: Builder failing to sync new git projects
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
peircej committed Feb 24, 2021
1 parent 485d29c commit 33b3d80
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions psychopy/projects/pavlovia.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,13 @@ def getGitRoot(p):
if not p.is_dir():
p = p.parent # given a file instead of folder?

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

0 comments on commit 33b3d80

Please sign in to comment.