Created
December 21, 2016 14:29
-
-
Save a7madgamal/ab6e82c7490379be6427245ce95e3420 to your computer and use it in GitHub Desktop.
Sourcetree action - Open commit in Gitlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# a sourcetree custom action to open the selected commit in gitlab (easy to change to a similar url) | |
# 1- download this file somewhere and make sure it's executable | |
# 2- sourcetree > prefreances > custom actions > add > 'Open commit in gitlab' as title > select script > $SHA in params | |
# | |
# Ahmed Hassanein - Tickaroo | |
gitRemote=$(git config --get remote.origin.url) | |
if [ "$gitRemote" == "" ] | |
then | |
echo "Not a git repository or no remote.origin.url set" | |
fi | |
re=':(.*)\.git' | |
if [[ $gitRemote =~ $re ]] | |
then | |
giturl=https://git.tickaroo.com/${BASH_REMATCH[1]}/commit/$(echo $1|tr -d '\n') | |
open "$giturl" | |
else | |
echo "Git URL does not match: $gitRemote" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment