diff --git a/git-open b/git-open index 630bb67..cc5b8b8 100755 --- a/git-open +++ b/git-open @@ -49,8 +49,7 @@ remote=${1:-$default_remote} remote=${remote:-$tracked_remote} remote=${remote:-"origin"} -# @TODO ls-remote will also expand "insteadOf" items `giturl=$(git ls-remote --get-url $remote)`` -giturl=$(git config --get "remote.${remote}.url") +giturl=$(git ls-remote --get-url "$remote") if [[ -z "$giturl" ]]; then echo "Git remote is not set for $remote" 1>&2 diff --git a/test/git-open.bats b/test/git-open.bats index b726f5d..1577a67 100755 --- a/test/git-open.bats +++ b/test/git-open.bats @@ -35,6 +35,18 @@ setup() { assert_output --partial "usage: git open" } +## +## url handling +## + +@test "url: insteadOf handling" { + git config --global url.http://example.com/.insteadOf ex: + git remote set-url origin ex:example.git + git checkout -B master + run ../git-open + assert_output "http://example.com/example" +} + ## ## GitHub ##