Skip to content

Commit 7449bfa

Browse files
authored
Merge pull request #115 from larsks/feature/ls-url
Use ls-remote --get-url to get remote url
2 parents beebcdb + 740222b commit 7449bfa

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

git-open

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ remote=${1:-$default_remote}
4949
remote=${remote:-$tracked_remote}
5050
remote=${remote:-"origin"}
5151

52-
# @TODO ls-remote will also expand "insteadOf" items `giturl=$(git ls-remote --get-url $remote)``
53-
giturl=$(git config --get "remote.${remote}.url")
52+
giturl=$(git ls-remote --get-url "$remote")
5453

5554
if [[ -z "$giturl" ]]; then
5655
echo "Git remote is not set for $remote" 1>&2

test/git-open.bats

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ setup() {
3535
assert_output --partial "usage: git open"
3636
}
3737

38+
##
39+
## url handling
40+
##
41+
42+
@test "url: insteadOf handling" {
43+
git config --global url.http://example.com/.insteadOf ex:
44+
git remote set-url origin ex:example.git
45+
git checkout -B master
46+
run ../git-open
47+
assert_output "http://example.com/example"
48+
}
49+
3850
##
3951
## GitHub
4052
##

0 commit comments

Comments
 (0)