diff --git a/ai_commit_msg/cli/conventional_commit_handler.py b/ai_commit_msg/cli/conventional_commit_handler.py index 3f5d094..ed1f566 100644 --- a/ai_commit_msg/cli/conventional_commit_handler.py +++ b/ai_commit_msg/cli/conventional_commit_handler.py @@ -3,7 +3,6 @@ from ai_commit_msg.utils.logger import Logger from ai_commit_msg.utils.utils import execute_cli_command from ai_commit_msg.utils.error import AIModelHandlerError -from ai_commit_msg.utils.git_utils import handle_git_push COMMIT_TYPES = { @@ -163,5 +162,3 @@ def conventional_commit_handler(args): return execute_cli_command(["git", "commit", "-m", f'"{formatted_commit}"'], output=True) - - handle_git_push() \ No newline at end of file diff --git a/ai_commit_msg/cli/gen_ai_commit_message_handler.py b/ai_commit_msg/cli/gen_ai_commit_message_handler.py index ba03e17..6f6e303 100644 --- a/ai_commit_msg/cli/gen_ai_commit_message_handler.py +++ b/ai_commit_msg/cli/gen_ai_commit_message_handler.py @@ -32,7 +32,6 @@ def gen_ai_commit_message_handler(): command_string = f""" git commit -m "{ai_gen_commit_msg}" -git push Would you like to commit your changes? (y/n): """ @@ -47,6 +46,4 @@ def gen_ai_commit_message_handler(): execute_cli_command(["git", "commit", "-m", ai_gen_commit_msg], output=True) - handle_git_push() - return 0 diff --git a/ai_commit_msg/utils/git_utils.py b/ai_commit_msg/utils/git_utils.py deleted file mode 100644 index 10e3bfd..0000000 --- a/ai_commit_msg/utils/git_utils.py +++ /dev/null @@ -1,30 +0,0 @@ -from ai_commit_msg.services.git_service import GitService -from ai_commit_msg.utils.utils import execute_cli_command -from ai_commit_msg.utils.logger import Logger - - -def handle_git_push(): - """ - Handle git push operation with upstream branch setting if needed. - Returns True if push was successful, False otherwise. - """ - logger = Logger() - current_branch = GitService.get_current_branch() - has_upstream = GitService.has_upstream_branch(current_branch) - - if has_upstream: - execute_cli_command(["git", "push"], output=True) - return True - - set_upstream = input( - f"No upstream branch found for '{current_branch}'. This will run: 'git push --set-upstream origin {current_branch}'. Set upstream? (y/n): " - ) - if set_upstream.lower() == "y": - execute_cli_command( - ["git", "push", "--set-upstream", "origin", current_branch], output=True - ) - logger.log(f"🔄 Upstream branch set for '{current_branch}'") - return True - else: - logger.log("Skipping push. You can set upstream manually") - return False