diff --git a/git-open.zsh b/git-open.zsh index 0eea38f..c1809b3 100755 --- a/git-open.zsh +++ b/git-open.zsh @@ -218,8 +218,8 @@ git_open_new_pr() { default_branch="master" fi - branch="$(uriencode $(trim $branch))" - default_branch="$(uriencode $(trim $default_branch))" + branch="$(uriencode "$(trim "$branch")")" + default_branch="$(uriencode "$(trim "$default_branch")")" case "$remote_type" in github) open_url "$silent" "https://github.com/$repo_path/compare/$default_branch...$branch" ;; diff --git a/tests/test.zsh b/tests/test.zsh index f5d8028..9f6d55e 100755 --- a/tests/test.zsh +++ b/tests/test.zsh @@ -80,6 +80,7 @@ assert_value "https://github.com/chenasraf/git-open/compare/develop...master" $( assert_value "https://github.com/chenasraf/git-open/compare/master...develop" $(git_open_new_pr -f develop) assert_value "https://github.com/chenasraf/git-open/compare/master...$current_branch" $(git_open_new_pr -f) assert_value "https://github.com/chenasraf/git-open/compare/develop...master" $(git_open_new_pr -f "master " " develop ") +assert_value "https://github.com/chenasraf/git-open/compare/master...feature%2Flong-branch-name" $(git_open_new_pr -f "feature/long-branch-name" "master") describe "git_open_pipelines" assert_value "https://github.com/chenasraf/git-open/actions" $(git_open_pipelines)