From 564efc560c137ec5120f21a5cc4e575f11e375e8 Mon Sep 17 00:00:00 2001 From: Nathan Stilwell Date: Tue, 22 Sep 2015 17:38:14 -0400 Subject: [PATCH] Only run gerrit plugin for repos on gerrit --- plugins/gerrit/gerrit.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/gerrit/gerrit.plugin.zsh b/plugins/gerrit/gerrit.plugin.zsh index d72278d29..92cd8b464 100644 --- a/plugins/gerrit/gerrit.plugin.zsh +++ b/plugins/gerrit/gerrit.plugin.zsh @@ -89,6 +89,12 @@ function gerrit_setup () { function gerrit () { + gitRemoteUrl=`git config --get remote.origin.url`; + if [[ $gitRemoteUrl != *"gerrit"* ]]; then + echo "This repository isn't on Gerrit Host."; + return; + fi + ref=$(git symbolic-ref HEAD 2> /dev/null); branch=${ref#refs/heads/}; @@ -104,5 +110,4 @@ function gerrit () { [ "$1" = "clone" ] && gerrit_clone "$2"; [ "$1" = "setup" ] && gerrit_setup; fi - }