@@ -47,49 +47,49 @@ unshorten() {
47
47
}
48
48
49
49
# git-open: Open Git repository in web browser
50
- git-open () {
51
- current_location=" $( pwd) "
52
- working_dir=${1:- $(pwd)}
53
- working_dir=" $( realpath " $working_dir " ) "
50
+ # git-open() {
51
+ # current_location="$(pwd)"
52
+ # working_dir=${1:-$(pwd)}
53
+ # working_dir="$(realpath "$working_dir")"
54
54
55
- if ! test -d " $working_dir " ; then
56
- return
57
- elif ! test -d " $working_dir /.git" ; then
58
- return
59
- fi
55
+ # if ! test -d "$working_dir"; then
56
+ # return
57
+ # elif ! test -d "$working_dir/.git"; then
58
+ # return
59
+ # fi
60
60
61
- branch=" $( git -C " $working_dir " symbolic-ref -q --short HEAD) "
61
+ # branch="$(git -C "$working_dir" symbolic-ref -q --short HEAD)"
62
62
63
- # Use `GitHub CLI` to open git repository
64
- if command -v gh > /dev/null 2>&1 ; then
65
- cd " $working_dir " && gh repo view --branch " $branch " --web
66
- cd " $current_location " || exit 0
67
- # Resolve git url
68
- else
69
- remote=" $( git -C " $working_dir " config " branch.$branch .remote" ) "
70
- url=" $( git -C " $working_dir " ls-remote --get-url " $remote " ) "
63
+ # # Use `GitHub CLI` to open git repository
64
+ # if command -v gh >/dev/null 2>&1; then
65
+ # cd "$working_dir" && gh repo view --branch "$branch" --web
66
+ # cd "$current_location" || exit 0
67
+ # # Resolve git url
68
+ # else
69
+ # remote="$(git -C "$working_dir" config "branch.$branch.remote")"
70
+ # url="$(git -C "$working_dir" ls-remote --get-url "$remote")"
71
71
72
- if [[ " $url " =~ ^[a-z\+ ]+://.* ]]; then
73
- uri=${url#*:// }
74
- uri=${uri#*@ }
75
- domain=${uri%%/* }
76
- urlpath=${uri#*/ }
72
+ # if [[ "$url" =~ ^[a-z\+]+://.* ]]; then
73
+ # uri=${url#*://}
74
+ # uri=${uri#*@}
75
+ # domain=${uri%%/*}
76
+ # urlpath=${uri#*/}
77
77
78
- gitprotocol=${url%%://* }
78
+ # gitprotocol=${url%%://*}
79
79
80
- if [[ $gitprotocol != ' https' && $gitprotocol != ' http' ]]; then
81
- domain=${domain%:* }
82
- fi
83
- else
84
- uri=${url##*@ }
85
- domain=${uri%%:* }
86
- urlpath=${uri#*: }
87
- fi
88
- urlpath=${urlpath#/ } urlpath=${urlpath%/ } urlpath=${urlpath% .git}
89
- if [[ $gitprotocol == ' http' ]]; then protocol=' http' ; else protocol=' https' ; fi
80
+ # if [[ $gitprotocol != 'https' && $gitprotocol != 'http' ]]; then
81
+ # domain=${domain%:*}
82
+ # fi
83
+ # else
84
+ # uri=${url##*@}
85
+ # domain=${uri%%:*}
86
+ # urlpath=${uri#*:}
87
+ # fi
88
+ # urlpath=${urlpath#/} urlpath=${urlpath%/} urlpath=${urlpath%.git}
89
+ # if [[ $gitprotocol == 'http' ]]; then protocol='http'; else protocol='https'; fi
90
90
91
- openurl=" $protocol ://$domain /$urlpath /tree/$branch "
92
- echo " Opening $openurl in your browser."
93
- start " $openurl "
94
- fi
95
- }
91
+ # openurl="$protocol://$domain/$urlpath/tree/$branch"
92
+ # echo "Opening $openurl in your browser."
93
+ # start "$openurl"
94
+ # fi
95
+ # }
0 commit comments