From 5990ada146925eee46c8a34c5c70b6a5882a0a4f Mon Sep 17 00:00:00 2001 From: KaySar12 Date: Tue, 20 May 2025 16:58:00 +0700 Subject: [PATCH] refactor: move submodule status logic in push_code function --- scripts/interpreter/gen_commit.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/interpreter/gen_commit.py b/scripts/interpreter/gen_commit.py index ae43002..d417d1f 100755 --- a/scripts/interpreter/gen_commit.py +++ b/scripts/interpreter/gen_commit.py @@ -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()