refactor: move submodule status logic in push_code function

This commit is contained in:
KaySar12 2025-05-20 16:58:00 +07:00
parent 10bd144b6e
commit 5990ada146

View File

@ -210,18 +210,7 @@ async def push_code():
os.chdir(project_path)
print(f"Changed to project path: {project_path}")
# Get submodule information
submodule_diffs = {}
if await has_submodules():
submodule_info = await get_submodule_info()
for path in submodule_info:
submodule_diffs[path] = get_git_diff(path)
# Format and print the tree output
tree_output = format_tree_output(project_path, submodule_diffs)
print("\nProject Status:")
print(tree_output)
print()
# Rest of the push_code function remains the same
proc = await asyncio.create_subprocess_exec(
@ -261,6 +250,17 @@ async def push_code():
elif stderr:
# Not an error; just info output
print(stderr.decode())
submodule_diffs = {}
if await has_submodules():
submodule_info = await get_submodule_info()
for path in submodule_info:
submodule_diffs[path] = get_git_diff(path)
# Format and print the tree output
tree_output = format_tree_output(project_path, submodule_diffs)
print("\nProject Status:")
print(tree_output)
print()