@@ -117,12 +117,12 @@ def confirm_proceeding_with_no_git_repo() -> str | bool:
117
117
return True
118
118
119
119
120
- def check_and_push_branch (repo : git .Repo , wait_for_push : bool = False ) -> bool : # noqa: FBT001, FBT002
120
+ def check_and_push_branch (repo : git .Repo , git_remote : str | None = "origin" , wait_for_push : bool = False ) -> bool : # noqa: FBT001, FBT002
121
121
current_branch = repo .active_branch .name
122
- origin = repo .remote (name = "origin" )
122
+ remote = repo .remote (name = git_remote )
123
123
124
124
# Check if the branch is pushed
125
- if f"origin /{ current_branch } " not in repo .refs :
125
+ if f"{ git_remote } /{ current_branch } " not in repo .refs :
126
126
logger .warning (f"⚠️ The branch '{ current_branch } ' is not pushed to the remote repository." )
127
127
if not sys .__stdin__ .isatty ():
128
128
logger .warning ("Non-interactive shell detected. Branch will not be pushed." )
@@ -132,13 +132,13 @@ def check_and_push_branch(repo: git.Repo, wait_for_push: bool = False) -> bool:
132
132
f"the branch '{ current_branch } ' to the remote repository?" ,
133
133
default = False ,
134
134
):
135
- origin .push (current_branch )
136
- logger .info (f"⬆️ Branch '{ current_branch } ' has been pushed to origin ." )
135
+ remote .push (current_branch )
136
+ logger .info (f"⬆️ Branch '{ current_branch } ' has been pushed to { git_remote } ." )
137
137
if wait_for_push :
138
138
time .sleep (3 ) # adding this to give time for the push to register with GitHub,
139
139
# so that our modifications to it are not rejected
140
140
return True
141
- logger .info (f"🔘 Branch '{ current_branch } ' has not been pushed to origin ." )
141
+ logger .info (f"🔘 Branch '{ current_branch } ' has not been pushed to { git_remote } ." )
142
142
return False
143
143
logger .debug (f"The branch '{ current_branch } ' is present in the remote repository." )
144
144
return True
0 commit comments