diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-08-23 12:37:30 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-08-23 13:23:24 +0000 |
commit | 413c116843fc9457a64616e4841ce73f7a061cbb (patch) | |
tree | 88c9b9e099fd660e9448658269a68c9c0034e9eb /morphlib/git.py | |
parent | e0bfd1a900fa0945a707ac219c282e95ca8527df (diff) | |
download | morph-413c116843fc9457a64616e4841ce73f7a061cbb.tar.gz |
Use Submodules class to read submodule config
Previously it would use `git config --get-regex`, which while more
terse, is a little arcane and the regular expression did not account
for slashes or dashes in the option names, and the names usually
correspond to a file path.
Now we use the Submodules class, which validates that the listed commit
is available.
Diffstat (limited to 'morphlib/git.py')
-rw-r--r-- | morphlib/git.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/morphlib/git.py b/morphlib/git.py index ff5e5c7d..4ff08a72 100644 --- a/morphlib/git.py +++ b/morphlib/git.py @@ -149,12 +149,12 @@ def update_submodules(app, repo_dir): # pragma: no cover resolver = morphlib.repoaliasresolver.RepoAliasResolver( app.settings['repo-alias']) app.runcmd(['git', 'submodule', 'init'], cwd=repo_dir) - urls = app.runcmd( - ['git', 'config', '--get-regexp', r'submodule.\w+.url'], - cwd=repo_dir) - for line in urls.splitlines(): - setting, url = line.split(' ') - app.runcmd(['git', 'config', setting, resolver.pull_url(url)], + submodules = Submodules(app, repo_dir, 'HEAD') + submodules.load() + for submodule in submodules: + app.runcmd(['git', 'config', + 'submodule.%s.url' % submodule.name, + resolver.pull_url(submodule.url)], cwd=repo_dir) app.runcmd(['git', 'submodule', 'update'], cwd=repo_dir) |