gitlab: fix issue ID parsing (#183)

This commit is contained in:
kazufusa 2022-07-19 04:46:28 +09:00 committed by GitHub
parent 0296983a28
commit 8ac94bf7c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -177,7 +177,8 @@ IFS='/' read -r -a pathargs <<<"$urlpath"
if (( is_issue )); then
# For issues, take the numbers and preprend 'issues/'
providerBranchRef="/issues/${remote_ref//[^0-9]/}"
[[ $remote_ref =~ [0-9]+ ]]
providerBranchRef="/issues/${BASH_REMATCH[0]}"
else
# Make # and % characters url friendly
# github.com/paulirish/git-open/pull/24

View file

@ -522,6 +522,13 @@ setup() {
assert_output "https://git.example.com:7000/XXX/YYY"
}
@test "gitlab: issue" {
git remote set-url origin "git@gitlab.example.com:user/repo"
git checkout -B "10-bump-up-to-v2.0"
run ../git-open "--issue"
assert_output "https://gitlab.example.com/user/repo/issues/10"
}
##
## Visual Studio Team Services
##