-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgh-open
More file actions
executable file
·28 lines (23 loc) · 788 Bytes
/
Copy pathgh-open
File metadata and controls
executable file
·28 lines (23 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
set -e
if [ -n "$1" ] ; then
REV=$1
shift
else
REV=HEAD
fi
if [ -n "$1" ] ; then
REV=$1
fi
BRANCH=$(git rev-parse --abbrev-ref $REV)
BASE_BRANCH=$(find_upstream_branch)
BASE_REPO=$(git config sync.upstreamRepo)
REMOTE=$(git config --get remote.origin.url | sed -n 's/^.*:\(.*\)\.git/\1/ p')
BASE_REMOTE=$(git config --get remote.${BASE_REPO}.url | sed -n 's/^.*github.com[:/]\(.*\)\/.*/\1/ p')
if [ "$BASE_REMOTE" != "origin" ] ; then
#google-chrome "https://github.com/$REMOTE/compare/$BASE_REMOTE:$BASE_BRANCH...$BRANCH"
xdg-open "https://github.com/$REMOTE/compare/$BASE_REMOTE:$BASE_BRANCH...$BRANCH"
else
#google-chrome "https://github.com/$REMOTE/compare/$BASE_BRANCH...$BRANCH"
xdg-open "https://github.com/$REMOTE/compare/$BASE_BRANCH...$BRANCH"
fi