Skip to content

Commit

Permalink
If submodules are not found, don't error out.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdehaan committed Sep 28, 2014
1 parent 952a369 commit 21c3784
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ansible/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ def default(value, function):
return value


def _gitrepoinfo(repo_path):
def _git_repo_info(repo_path):
''' returns a string containing git branch, commit id and commit date '''
result = None
if os.path.exists(repo_path):
Expand Down Expand Up @@ -877,14 +877,16 @@ def _gitrepoinfo(repo_path):
def _gitinfo():
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
repo_path = os.path.join(basedir, '.git')
result = _gitrepoinfo(repo_path)
result = _git_repo_info(repo_path)
submodules = os.path.join(basedir, '.gitmodules')
if not os.path.exists(submodules):
return result
f = open(submodules)
for line in f:
tokens = line.strip().split(' ')
if tokens[0] == 'path':
submodule_path = tokens[2]
submodule_info =_gitrepoinfo(os.path.join(basedir, submodule_path, '.git'))
submodule_info =_git_repo_info(os.path.join(basedir, submodule_path, '.git'))
if not submodule_info:
submodule_info = ' not found - use git submodule update --init ' + submodule_path
result += "\n {0}: {1}".format(submodule_path, submodule_info)
Expand Down

0 comments on commit 21c3784

Please sign in to comment.