mirror of
https://github.com/chenasraf/git-open.git
synced 2026-05-18 01:38:59 +00:00
fix: trim branch before uriencode
This commit is contained in:
@@ -17,6 +17,10 @@ uriencode() {
|
||||
done
|
||||
}
|
||||
|
||||
trim() {
|
||||
echo "$1" | sed -E 's/^[ \t]+|[ \t]+$//g'
|
||||
}
|
||||
|
||||
git_get_remote() {
|
||||
remote=$(git remote -v | grep "(push)" | awk '{print $2}')
|
||||
echo $remote
|
||||
@@ -214,8 +218,8 @@ git_open_new_pr() {
|
||||
default_branch="master"
|
||||
fi
|
||||
|
||||
branch=$(uriencode $branch)
|
||||
default_branch=$(uriencode $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" ;;
|
||||
|
||||
@@ -79,6 +79,7 @@ describe "git_open_new_pr"
|
||||
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...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 ")
|
||||
|
||||
describe "git_open_pipelines"
|
||||
assert_value "https://github.com/chenasraf/git-open/actions" $(git_open_pipelines)
|
||||
|
||||
Reference in New Issue
Block a user