Skip to content

Commit

Permalink
push: only copy GitHub compare url if remote is on GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiew committed Feb 27, 2011
1 parent 8c5b721 commit fc39ebd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions push
Expand Up @@ -31,15 +31,16 @@ fi
echo $push

# Parse output into sexy GitHub compare URL!
# TODO only do this if the remote is actually on GitHub :)
remote_url=$(git remote show $remote -n | grep Push | awk '{ print $3 }')
repo_name=$(echo $remote_url | sed 's/.*\:\(.*\)\.git/\1/')
refs=$(echo $push | awk '{ print $3}' | sed 's/\.\./\.\.\./')
if [[ ! "$remote_url" =~ "github.com" ]]; then
repo_name=$(echo $remote_url | sed 's/.*\:\(.*\)\.git/\1/')
refs=$(echo $push | awk '{ print $3}' | sed 's/\.\./\.\.\./')

github_url="https://github.com/$repo_name/compare/$refs"
which -s pbcopy && echo $github_url | pbcopy && echo "Compare URL copied to clipboard!"
# which -s open && open -g $github_url
echo $github_url
github_url="https://github.com/$repo_name/compare/$refs"
which -s pbcopy && echo $github_url | pbcopy && echo "Compare URL copied to clipboard!"
# which -s open && open -g $github_url
echo $github_url

echo
echo
fi
exit 0

0 comments on commit fc39ebd

Please sign in to comment.