Skip to content

Commit

Permalink
if submodule does not exist add it
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Apr 23, 2024
1 parent 5a1e5f6 commit 5398ef4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions git_fleximod/git_fleximod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit 5398ef4

Please sign in to comment.