mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
refactor: rename to --ignore-branch
This commit is contained in:
parent
6a41a88a0c
commit
7413b8d7a8
16
git-open
16
git-open
|
|
@ -16,11 +16,11 @@ git open [remote] [branch]
|
|||
https://github.com/paulirish/git-open/
|
||||
|
||||
Available options are
|
||||
c,commit! open current commit
|
||||
i,issue! open issues page
|
||||
s,suffix= append this suffix
|
||||
p,print! just print the url
|
||||
d,default-branch! open the repo as if you were in the default branch (master/main)
|
||||
c,commit! open current commit
|
||||
i,issue! open issues page
|
||||
s,suffix= append this suffix
|
||||
p,print! just print the url
|
||||
b,ignore-branch! just open the repo regardless of the currently checked out branch
|
||||
"
|
||||
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC1090
|
||||
|
|
@ -33,7 +33,7 @@ is_issue=0
|
|||
protocol="https"
|
||||
print_only=0
|
||||
suffix_flag=""
|
||||
use_default_branch=0
|
||||
ignore_branch=0
|
||||
|
||||
while test $# != 0; do
|
||||
case "$1" in
|
||||
|
|
@ -41,7 +41,7 @@ while test $# != 0; do
|
|||
--issue) is_issue=1;;
|
||||
--suffix=*) suffix_flag="$1";;
|
||||
--print) print_only=1;;
|
||||
--default-branch) use_default_branch=1;;
|
||||
--ignore-branch) ignore_branch=1;;
|
||||
--) shift; break ;;
|
||||
esac
|
||||
shift
|
||||
|
|
@ -244,7 +244,7 @@ openurl="$protocol://$domain/$urlpath"
|
|||
if (( is_commit )); then
|
||||
sha=$(git rev-parse HEAD)
|
||||
openurl="$openurl/commit/$sha"
|
||||
elif [[ $remote_ref != "master" && $remote_ref != "main" && $use_default_branch != 1 ]]; then
|
||||
elif [[ $remote_ref != "master" && $remote_ref != "main" && $ignore_branch != 1 ]]; then
|
||||
# simplify URL for master and main
|
||||
openurl="$openurl$providerBranchRef"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ git hosting services are supported.
|
|||
it will open the webpage with that issue. See `EXAMPLES` for more information.
|
||||
This only works on GitHub, GitLab, Visual Studio Team Services and Team Foundation Server at the moment.
|
||||
|
||||
`-d`, `--default-branch`
|
||||
Open the repository as if you were in the default branch (`master`/`main`)
|
||||
`-b`, `--ignore-branch`
|
||||
Just open the repository regardless of the currently checked out branch
|
||||
|
||||
`-s`, `--suffix` some_suffix
|
||||
Append the given suffix to the url
|
||||
|
|
@ -64,10 +64,10 @@ https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123
|
|||
|
||||
|
||||
```sh
|
||||
git open --default-branch
|
||||
git open --ignore-branch
|
||||
```
|
||||
|
||||
It won't suffix the url with `/tree/CURRENT_BRANCH` even if you aren't currently on `master` or `main` branch, it opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/
|
||||
It won't suffix the url with `/tree/CURRENT_BRANCH` regardless of the currently checked out branch, it opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/
|
||||
|
||||
```sh
|
||||
git open --suffix pulls
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ setup() {
|
|||
git config --local url.http://example.com/.insteadOf ex:
|
||||
git remote set-url origin ex:example.git
|
||||
git checkout -B development
|
||||
run ../git-open -d
|
||||
run ../git-open -b
|
||||
assert_output "http://example.com/example"
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ setup() {
|
|||
git config --local url.http://example.com/.insteadOf ex:
|
||||
git remote set-url origin ex:example.git
|
||||
git checkout -B development
|
||||
run ../git-open -d -s actions
|
||||
run ../git-open -b -s actions
|
||||
assert_output "http://example.com/example/actions"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue