Skip to content

Commit

Permalink
Add test, strip all whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Sep 17, 2024
1 parent b9069bf commit efc4c86
Show file tree
Hide file tree
Showing 2 changed files with 5 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 @@ -196,7 +196,7 @@ def sorted_branches(self):
@property
def username(self):
cmd = ["git", "config", "--get", f"remote.{self.pr_remote}.url"]
result = self.run_cmd(cmd, required_real_result=True).strip("\n")
result = self.run_cmd(cmd, required_real_result=True).strip()
# implicit ssh URIs use : to separate host from user, others just use /
username = result.replace(":", "/").rstrip("/").split("/")[-2]
return username
Expand Down
4 changes: 4 additions & 0 deletions cherry_picker/test_cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ def test_get_pr_url(config):
b"https://github.com/mock_user/cpython.git",
b"https://github.com/mock_user/cpython",
b"https://github.com/mock_user/cpython/",
# test trailing whitespace
b"https://github.com/mock_user/cpython.git\n",
b"https://github.com/mock_user/cpython\n",
b"https://github.com/mock_user/cpython/\n",
],
)
def test_username(url, config):
Expand Down

0 comments on commit efc4c86

Please sign in to comment.