Skip to content

Commit

Permalink
fix: finding git repo root when project is in a subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydw committed Feb 8, 2022
1 parent b9ab98d commit dfa971f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions grow/common/utils.py
Expand Up @@ -66,10 +66,13 @@ def get_grow_dir():


def get_git_repo(root):
try:
return git.Repo(root)
except git.InvalidGitRepositoryError:
logging.info('WARNING: No Git repository found in {}'.format(root))
original_root = root
while root != '/':
try:
return git.Repo(root)
except git.InvalidGitRepositoryError:
root = os.path.abspath(os.path.join(root, '..'))
logging.info('WARNING: No Git repository found from: {}'.format(original_root))


def interactive_confirm(message, default=False, input_func=None):
Expand Down

0 comments on commit dfa971f

Please sign in to comment.