Merge pull request #166 from glostis/fix-suffix

Fix suffix with `=` in it
This commit is contained in:
Dave Wikoff 2020-07-07 14:46:30 -07:00 committed by GitHub
commit 3e8c908dcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -46,7 +46,8 @@ done
# parse suffix from suffix=value
IFS='=' read -ra suffix_flag <<< "$suffix_flag"
suffix=${suffix_flag[1]}
function join_by { local IFS="$1"; shift; echo "$*"; }
suffix=$(join_by "=" "${suffix_flag[@]:1}")
# are we in a git repo?
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
@ -143,7 +144,7 @@ else
# Resolve sshconfig aliases
if [[ -e "$ssh_config" ]]; then
domain_resolv=$(ssh_resolve "$domain")
if [[ ! -z "$domain_resolv" ]]; then
if [[ -n "$domain_resolv" ]]; then
domain="$domain_resolv"
fi
fi

View file

@ -172,6 +172,11 @@ setup() {
assert_output "https://github.com/paulirish/git-open/anySuffix"
}
@test "gh: git open --suffix anySuffix?hello=world" {
run ../git-open "--suffix" "anySuffix?hello=world"
assert_output "https://github.com/paulirish/git-open/anySuffix?hello=world"
}
@test "gh: gist" {
git remote set-url origin "git@gist.github.com:2d84a6db1b41b4020685.git"
run ../git-open