Skip to content

Commit 6bb734a

Browse files
committed
Change gitea_api.Git to work with the current remote instead of 'origin'
1 parent 172e827 commit 6bb734a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

osc/gitea_api/git.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def fetch_pull_request(
107107
self,
108108
pull_number: int,
109109
*,
110-
remote: str = "origin",
110+
remote: Optional[str] = None,
111111
commit: Optional[str] = None,
112112
force: bool = False,
113113
):
@@ -120,6 +120,9 @@ def fetch_pull_request(
120120
if commit and self.branch_exists(target_branch) and self.get_branch_head(target_branch) == commit:
121121
return target_branch
122122

123+
if not remote:
124+
remote = self.get_current_remote()
125+
123126
cmd = ["fetch", remote, f"pull/{pull_number}/head:{target_branch}"]
124127
if force:
125128
cmd += [
@@ -171,7 +174,7 @@ def fetch(self, name: Optional[str] = None):
171174
cmd = ["fetch", "--all"]
172175
self._run_git(cmd)
173176

174-
def get_owner_repo(self, remote: str = "origin") -> Tuple[str, str]:
177+
def get_owner_repo(self, remote: Optional[str] = None) -> Tuple[str, str]:
175178
remote_url = self.get_remote_url(name=remote)
176179
if "@" in remote_url:
177180
# ssh://gitea@example.com:owner/repo.git

0 commit comments

Comments
 (0)