Cater for uninitialized submodules

Output a useful message if `git submodule update --init --recursive` not
yet performed

```
$ ansible --version
ansible 1.8 (submodule_ansible_version 59ae596484) last updated 2014/09/28 13:20:51 (GMT +1000)
  lib/ansible/modules/core: (detached HEAD 617a52b20d) last updated 2014/09/28 13:15:25 (GMT +1000)
  lib/ansible/modules/extras:  not found - use git submodule update --init lib/ansible/modules/extras
```
This commit is contained in:
Will Thames 2014-09-28 13:19:56 +10:00 committed by Michael DeHaan
parent d1476aeb01
commit 952a36920c

View file

@ -883,8 +883,11 @@ def _gitinfo():
for line in f:
tokens = line.strip().split(' ')
if tokens[0] == 'path':
repo_path = tokens[2]
result += "\n {0}: {1}".format(repo_path, _gitrepoinfo(os.path.join(basedir, repo_path, '.git')))
submodule_path = tokens[2]
submodule_info =_gitrepoinfo(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)
f.close()
return result