Skip to content

Commit

Permalink
add optional to status output
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jun 8, 2024
1 parent 87640ad commit 2ede182
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions git_fleximod/git_fleximod.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def submodules_status(gitmodules, root_dir, toplevel=False):
ahash = result[0][1:]
hhash = None
atag = None

needsupdate += 1
if not toplevel and level:
continue
Expand All @@ -316,22 +317,23 @@ def submodules_status(gitmodules, root_dir, toplevel=False):
hhash = htag.split()[0]
if hhash and atag:
break
optional = " (optional)" if required and "Optional" in required else ""
if tag and (ahash == hhash or atag == tag):
print(f"e {name:>20} not checked out, aligned at tag {tag}")
print(f"e {name:>20} not checked out, aligned at tag {tag}{optional}")
elif tag:
ahash = rootgit.git_operation(
"submodule", "status", "{}".format(path)
).rstrip()
ahash = ahash[1 : len(tag) + 1]
if tag == ahash:
print(f"e {name:>20} not checked out, aligned at hash {ahash}")
print(f"e {name:>20} not checked out, aligned at hash {ahash}{optional}")
else:
print(
f"e {name:>20} not checked out, out of sync at tag {atag}, expected tag is {tag}"
f"e {name:>20} not checked out, out of sync at tag {atag}, expected tag is {tag}{optional}"
)
testfails += 1
else:
print(f"e {name:>20} has no fxtag defined in .gitmodules")
print(f"e {name:>20} has no fxtag defined in .gitmodules{optional}")
testfails += 1
else:
with utils.pushd(newpath):
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def logger():
"submodule_name": "test_optional",
"status1" : "test_optional MPIserial_2.5.0-3-gd82ce7c is out of sync with .gitmodules MPIserial_2.4.0",
"status2" : "test_optional at tag MPIserial_2.4.0",
"status3" : "test_optional not checked out, out of sync at tag None, expected tag is MPIserial_2.4.0",
"status3" : "test_optional not checked out, out of sync at tag None, expected tag is MPIserial_2.4.0 (optional)",
"status4" : "test_optional at tag MPIserial_2.4.0",
"gitmodules_content": """
[submodule "test_optional"]
Expand Down

0 comments on commit 2ede182

Please sign in to comment.