mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
feat: url simplification for main branch
This commit is contained in:
parent
f772364eb8
commit
58648dfdd2
4
git-open
4
git-open
|
|
@ -241,8 +241,8 @@ openurl="$protocol://$domain/$urlpath"
|
|||
if (( is_commit )); then
|
||||
sha=$(git rev-parse HEAD)
|
||||
openurl="$openurl/commit/$sha"
|
||||
elif [[ $remote_ref != "master" ]]; then
|
||||
# simplify URL for master
|
||||
elif [[ $remote_ref != "master" && $remote_ref != "main" ]]; then
|
||||
# simplify URL for master and main
|
||||
openurl="$openurl$providerBranchRef"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,14 @@ setup() {
|
|||
assert_output "http://example.com/example"
|
||||
}
|
||||
|
||||
@test "url: simplification" {
|
||||
git config --local url.http://example.com/.insteadOf ex:
|
||||
git remote set-url origin ex:example.git
|
||||
git checkout -B main
|
||||
run ../git-open
|
||||
assert_output "http://example.com/example"
|
||||
}
|
||||
|
||||
##
|
||||
## GitHub
|
||||
##
|
||||
|
|
|
|||
Loading…
Reference in a new issue