diff --git a/git_fleximod/git_fleximod.py b/git_fleximod/git_fleximod.py index 7957001..adf575f 100755 --- a/git_fleximod/git_fleximod.py +++ b/git_fleximod/git_fleximod.py @@ -235,10 +235,13 @@ def single_submodule_checkout( with open(os.path.join(repodir, ".git"), "w") as f: f.write("gitdir: " + os.path.relpath(newpath, start=repodir)) + + if not os.path.exists(repodir): + git.git_operation("submodule", "add", "--name", name, "--", url, path) if not repo_exists or not tmpurl: - logger.debug(git.git_operation("submodule", "update", "--init", "--", path)) - + git.git_operation("submodule", "update", "--init", "--", path) + if os.path.exists(os.path.join(repodir, ".gitmodules")): # recursively handle this checkout print(f"Recursively checking out submodules of {name}") @@ -311,6 +314,8 @@ def submodules_status(gitmodules, root_dir, toplevel=False): print(f" {name:>20} at tag {tag}") elif tag and ahash[: len(tag)] == tag: print(f" {name:>20} at hash {ahash}") + elif atag == ahash: + print(f" {name:>20} at hash {ahash}") elif tag: print( f"s {name:>20} {atag} {ahash} is out of sync with .gitmodules {tag}"