| skipped 15 lines |
16 | 16 | | https://github.com/paulirish/git-open/ |
17 | 17 | | |
18 | 18 | | Available options are |
| 19 | + | c,commit! open current commit |
19 | 20 | | i,issue! open issues page |
20 | 21 | | p,print! just print the url |
21 | 22 | | " |
| skipped 3 lines |
25 | 26 | | SUBDIRECTORY_OK='Yes' . "$(git --exec-path)/git-sh-setup" |
26 | 27 | | |
27 | 28 | | # Defaults |
| 29 | + | is_commit=0 |
28 | 30 | | is_issue=0 |
29 | 31 | | protocol="https" |
30 | 32 | | print_only=0 |
31 | 33 | | |
32 | 34 | | while test $# != 0; do |
33 | 35 | | case "$1" in |
| 36 | + | --commit) is_commit=1;; |
34 | 37 | | --issue) is_issue=1;; |
35 | 38 | | --print) print_only=1;; |
36 | 39 | | --) shift; break ;; |
| skipped 190 lines |
227 | 230 | | |
228 | 231 | | openurl="$protocol://$domain/$urlpath" |
229 | 232 | | |
230 | | - | # simplify URL for master |
231 | | - | if [[ $remote_ref != "master" ]]; then |
| 233 | + | if (( is_commit )); then |
| 234 | + | sha=$(git rev-parse HEAD) |
| 235 | + | openurl="$openurl/commit/$sha" |
| 236 | + | elif [[ $remote_ref != "master" ]]; then |
| 237 | + | # simplify URL for master |
232 | 238 | | openurl="$openurl$providerBranchRef" |
233 | 239 | | fi |
234 | 240 | | |
| skipped 26 lines |