Skip to content

Commit

Permalink
add git safe check to Brick.FromPath
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlue committed Dec 2, 2023
1 parent 4127349 commit ca1e199
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions biobricks/brick.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def FromPath(path):
"""Get the version of a brick from its git repo."""
bdir = bblib(path)
gsys = functools.partial(subprocess.check_output, shell=True, cwd=bdir)

is_safe = check_safe_git_repo(bdir)
if not is_safe:
subprocess.check_call(['git', 'config', '--global', '--add', 'safe.directory', bdir])

commit = gsys("git rev-parse HEAD").decode().strip()
remote = gsys("git config --get remote.origin.url").decode().strip()
return Brick(remote, commit)
Expand Down

0 comments on commit ca1e199

Please sign in to comment.