From 3f7f392de09a17f967c85f0f4b3deb6906e525e5 Mon Sep 17 00:00:00 2001 From: Benjamin Labrecque Date: Thu, 9 Jul 2026 14:42:09 +0200 Subject: [PATCH] chore: update ui service manager of new service --- cli/src/core/git.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/cli/src/core/git.py b/cli/src/core/git.py index 8ab43b6..61fc247 100644 --- a/cli/src/core/git.py +++ b/cli/src/core/git.py @@ -26,15 +26,14 @@ def git_push_changes( f"{master_ioc_subs_rel_path}..." f"{iocs_overview_rel_path}..." ) - repo.index.add( - [ - service_dir_rel_path, - registry_file_rel_path, - master_hla_names_rel_path, - master_ioc_subs_rel_path, - iocs_overview_rel_path, - ] - ) + files_to_stage = [ + service_dir_rel_path, + registry_file_rel_path, + master_hla_names_rel_path, + master_ioc_subs_rel_path, + iocs_overview_rel_path, + ] + repo.index.add(files_to_stage) # Check if there are changes to avoid empty commit crashes if not repo.is_dirty(index=True, working_tree=False): @@ -44,9 +43,14 @@ def git_push_changes( logger.info("Committing changes...") repo.index.commit(commit_msg) - logger.info(f"Pushing branch '{branch_name}' to origin...") - origin = repo.remote(name="origin") - origin.push(refspec=f"{branch_name}:{branch_name}").raise_if_error() + try: + logger.info(f"Pushing branch '{branch_name}' to origin...") + origin = repo.remote(name="origin") + origin.push(refspec=f"{branch_name}:{branch_name}").raise_if_error() + except Exception as e: + logger.info("Git resetting files") + repo.index.reset(files_to_stage) + raise e logger.info("Successfully pushed!")