diff --git a/cli/src/core/git.py b/cli/src/core/git.py index 78f5c15..8ab43b6 100644 --- a/cli/src/core/git.py +++ b/cli/src/core/git.py @@ -18,41 +18,37 @@ def git_push_changes( """ Push newly created service to Gitea """ - try: - logger.info( - "Staging files inside: " - f"{service_dir_rel_path}, " - f"{registry_file_rel_path}, " - f"{master_hla_names_rel_path}, " - 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, - ] - ) + logger.info( + "Staging files inside: " + f"{service_dir_rel_path}, " + f"{registry_file_rel_path}, " + f"{master_hla_names_rel_path}, " + 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, + ] + ) - # Check if there are changes to avoid empty commit crashes - if not repo.is_dirty(index=True, working_tree=False): - logger.info("No changes detected. Skipping commit.") - return + # Check if there are changes to avoid empty commit crashes + if not repo.is_dirty(index=True, working_tree=False): + logger.info("No changes detected. Skipping commit.") + return - logger.info("Committing changes...") - repo.index.commit(commit_msg) + 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() + 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() - logger.info("Successfully pushed!") - - except Exception as e: - raise RuntimeError(f"Git Operation Failed: {e}") from e + logger.info("Successfully pushed!") def delete_local_branch(repo: git.Repo, branch_name: str):