From 2c1738296e8245c39f891bc2b147f4c3a6e4300f Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Tue, 23 Sep 2014 17:48:01 +0800 Subject: =?UTF-8?q?bash=5Finclude:=20=E5=8A=A0=E5=85=A5=E6=AA=A2=E6=9F=A5?= =?UTF-8?q?=20git=20commit=20=E7=9A=84=E5=90=8D=E5=AD=97=E8=88=87=20email?= =?UTF-8?q?=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_include | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bash_include') diff --git a/bash_include b/bash_include index 0dafccc..b7b19e7 100644 --- a/bash_include +++ b/bash_include @@ -234,6 +234,32 @@ alias screen256='screen -T screen-256color' alias vimhtml='vim -c "set ts=2" -c "set sw=2"' +# Functions: Overrided external commands to prevent misuse ################### + +function git () +{ + if [ "$1" = "commit" ]; then + if [ "`command git config user.name`" = "LAN-TW" ]; then + printf '==> \e[1;31mBASHRC ERROR\e[m: STOP USING THIS CRYPTIC NAME!\n' + return 1 + fi + if command git config user.name | safe_grep ' ' >/dev/null; then :; + else + printf '==> \e[1;31mBASHRC ERROR\e[m: Your real name does not contain spaces!\n' + return 1 + fi + if [[ "$PWD" == *gnome* ]] || [[ "$PWD" == *jhbuild* ]]; then + if [[ "`command git config user.email`" == *gnome* ]]; then :; + else + printf '==> \e[1;31mBASHRC ERROR\e[m: Please use GNOME email for GNOME project!\n' + return 2 + fi + fi + fi + command git "$@" +} + + # Functions: Shared Internal Functions ####################################### function createdir_askmode () -- cgit v1.2.3