mirror of
https://github.com/chenasraf/git-open.git
synced 2026-05-18 01:38:59 +00:00
fix: github find pr
This commit is contained in:
10
git-open.zsh
10
git-open.zsh
@@ -183,10 +183,14 @@ git_open_pr_list() {
|
||||
}
|
||||
|
||||
git_open_new_pr() {
|
||||
existing="$(git_find_pr $@)"
|
||||
if [[ "$1" == "--force" || "$1" == "-f" ]]; then
|
||||
shift
|
||||
existing=""
|
||||
else
|
||||
existing="$(git_find_pr $@)"
|
||||
fi
|
||||
|
||||
if [[ -n "$existing" ]]; then
|
||||
echo "PR already exists: $existing"
|
||||
open_url "$silent" $existing
|
||||
return 0
|
||||
fi
|
||||
@@ -240,7 +244,7 @@ git_find_pr() {
|
||||
commit="$(git rev-parse $branch)"
|
||||
|
||||
case "$remote_type" in
|
||||
github) prrefs="pulls/*/head"; prfilt="pulls" ;;
|
||||
github) prrefs="pull/*/head"; prfilt="pull" ;;
|
||||
gitlab) prrefs="merge-requests/*/head"; prfilt="merge-requests" ;;
|
||||
bitbucket) prrefs="pull-requests/*/head"; prfilt="pull-requests" ;;
|
||||
esac
|
||||
|
||||
@@ -76,9 +76,9 @@ describe "git_open_pr_list"
|
||||
assert_value "https://github.com/chenasraf/git-open/pulls?q=is%3Apr+is%3Aopen" $(git_open_pr_list)
|
||||
|
||||
describe "git_open_new_pr"
|
||||
assert_value "https://github.com/chenasraf/git-open/compare/develop...master" $(git_open_new_pr master develop)
|
||||
assert_value "https://github.com/chenasraf/git-open/compare/master...develop" $(git_open_new_pr develop)
|
||||
assert_value "https://github.com/chenasraf/git-open/compare/master...$current_branch" $(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)
|
||||
|
||||
describe "git_open_pipelines"
|
||||
assert_value "https://github.com/chenasraf/git-open/actions" $(git_open_pipelines)
|
||||
|
||||
Reference in New Issue
Block a user