Merge pull request #115 from larsks/feature/ls-url

Use ls-remote --get-url to get remote url
This commit is contained in:
Dave Wikoff 2018-02-04 12:06:54 -05:00 committed by GitHub
commit 7449bfa7e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -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

View file

@ -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
##