Skip to content

Commit 3e8c908

Browse files
authored
Merge pull request #166 from glostis/fix-suffix
Fix suffix with `=` in it
2 parents d9a0d19 + 3bd3524 commit 3e8c908

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

git-open

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ done
4646

4747
# parse suffix from suffix=value
4848
IFS='=' read -ra suffix_flag <<< "$suffix_flag"
49-
suffix=${suffix_flag[1]}
49+
function join_by { local IFS="$1"; shift; echo "$*"; }
50+
suffix=$(join_by "=" "${suffix_flag[@]:1}")
5051

5152
# are we in a git repo?
5253
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
@@ -143,7 +144,7 @@ else
143144
# Resolve sshconfig aliases
144145
if [[ -e "$ssh_config" ]]; then
145146
domain_resolv=$(ssh_resolve "$domain")
146-
if [[ ! -z "$domain_resolv" ]]; then
147+
if [[ -n "$domain_resolv" ]]; then
147148
domain="$domain_resolv"
148149
fi
149150
fi

test/git-open.bats

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ setup() {
172172
assert_output "https://github.com/paulirish/git-open/anySuffix"
173173
}
174174

175+
@test "gh: git open --suffix anySuffix?hello=world" {
176+
run ../git-open "--suffix" "anySuffix?hello=world"
177+
assert_output "https://github.com/paulirish/git-open/anySuffix?hello=world"
178+
}
179+
175180
@test "gh: gist" {
176181
git remote set-url origin "[email protected]:2d84a6db1b41b4020685.git"
177182
run ../git-open

0 commit comments

Comments
 (0)