From 413c116843fc9457a64616e4841ce73f7a061cbb Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 23 Aug 2013 12:37:30 +0000 Subject: 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. --- morphlib/git.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'morphlib/git.py') 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) -- cgit v1.2.1