Checkout subproject submodules even when nested
This commit is contained in:
parent
d73e81c77b
commit
22a998188b
|
@ -372,12 +372,16 @@ class Resolver:
|
||||||
# definitely cannot try to conveniently set up a submodule.
|
# definitely cannot try to conveniently set up a submodule.
|
||||||
if not GIT:
|
if not GIT:
|
||||||
return False
|
return False
|
||||||
|
# Does the directory exist? Even uninitialised submodules checkout an
|
||||||
|
# empty directory to work in
|
||||||
|
if not os.path.isdir(self.dirname):
|
||||||
|
return False
|
||||||
# Are we in a git repository?
|
# Are we in a git repository?
|
||||||
ret, out = quiet_git(['rev-parse'], self.subdir_root)
|
ret, out = quiet_git(['rev-parse'], Path(self.dirname).parent)
|
||||||
if not ret:
|
if not ret:
|
||||||
return False
|
return False
|
||||||
# Is `dirname` a submodule?
|
# Is `dirname` a submodule?
|
||||||
ret, out = quiet_git(['submodule', 'status', self.dirname], self.subdir_root)
|
ret, out = quiet_git(['submodule', 'status', '.'], self.dirname)
|
||||||
if not ret:
|
if not ret:
|
||||||
return False
|
return False
|
||||||
# Submodule has not been added, add it
|
# Submodule has not been added, add it
|
||||||
|
@ -388,11 +392,12 @@ class Resolver:
|
||||||
raise WrapException('git submodule has merge conflicts')
|
raise WrapException('git submodule has merge conflicts')
|
||||||
# Submodule exists, but is deinitialized or wasn't initialized
|
# Submodule exists, but is deinitialized or wasn't initialized
|
||||||
elif out.startswith('-'):
|
elif out.startswith('-'):
|
||||||
if verbose_git(['submodule', 'update', '--init', self.dirname], self.subdir_root):
|
if verbose_git(['submodule', 'update', '--init', '.'], self.dirname):
|
||||||
return True
|
return True
|
||||||
raise WrapException('git submodule failed to init')
|
raise WrapException('git submodule failed to init')
|
||||||
# Submodule looks fine, but maybe it wasn't populated properly. Do a checkout.
|
# Submodule looks fine, but maybe it wasn't populated properly. Do a checkout.
|
||||||
elif out.startswith(' '):
|
elif out.startswith(' '):
|
||||||
|
verbose_git(['submodule', 'update', '.'], self.dirname)
|
||||||
verbose_git(['checkout', '.'], self.dirname)
|
verbose_git(['checkout', '.'], self.dirname)
|
||||||
# Even if checkout failed, try building it anyway and let the user
|
# Even if checkout failed, try building it anyway and let the user
|
||||||
# handle any problems manually.
|
# handle any problems manually.
|
||||||
|
|
Loading…
Reference in New Issue