From d8556c4c786a9e323462dd2a93a3240a9877abba Mon Sep 17 00:00:00 2001 From: Zhou Yicheng Date: Fri, 8 Mar 2019 15:12:07 +0800 Subject: [PATCH] Fix for remote url starting with https://github.com instead of git@github.com --- zsh/functions.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 6a1c5ee..64bac2c 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -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) }