Fix for remote url starting with https://github.com instead of git@github.com

This commit is contained in:
Zhou Yicheng 2019-03-08 15:12:07 +08:00
parent d654041a48
commit d8556c4c78

View File

@ -145,7 +145,7 @@ function gitcopy() {
;;
esac
done
repo=`git remote get-url origin | sed -E 's/.*:(.*)\.git/\1/'`
project_name=`echo $repo | sed -E 's/.*\/(.*)/\1/'`
git log $commit --pretty="* [$project_name](https://github.com/$repo/commit/%H) %an: **%s**" | head -n $n | tee >(pbcopy)
prefix=`git remote get-url origin | sed -E 's/git@github.com:/https:\/\/github.com\//g' | sed -E 's/(.*)\.git/\1/'`
project_name=`echo $prefix | sed -E 's/.*\/(.*)/\1/'`
git log $commit --pretty="* [$project_name]($prefix/commit/%H) %an: **%s**" | head -n $n | tee >(pbcopy)
}