Skip to content

Commit

Permalink
Resolve usernames when the remote ends with a trailing slash (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner authored Jan 21, 2024
1 parent c7a504f commit d7c3264
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def username(self):
cmd = ["git", "config", "--get", f"remote.{self.pr_remote}.url"]
result = self.run_cmd(cmd, required_real_result=True)
# implicit ssh URIs use : to separate host from user, others just use /
username = result.replace(":", "/").split("/")[-2]
username = result.replace(":", "/").rstrip("/").split("/")[-2]
return username

def get_cherry_pick_branch(self, maint_branch):
Expand Down
3 changes: 3 additions & 0 deletions cherry_picker/test_cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,13 @@ def test_get_pr_url(config):
[
b"[email protected]:mock_user/cpython.git",
b"[email protected]:mock_user/cpython",
b"[email protected]:mock_user/cpython/",
b"ssh://[email protected]/mock_user/cpython.git",
b"ssh://[email protected]/mock_user/cpython",
b"ssh://[email protected]/mock_user/cpython/",
b"https://github.com/mock_user/cpython.git",
b"https://github.com/mock_user/cpython",
b"https://github.com/mock_user/cpython/",
],
)
def test_username(url, config):
Expand Down

0 comments on commit d7c3264

Please sign in to comment.