summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2010-08-26 14:37:11 +0200
committerHugues Hiegel <hugues@hiegel.fr>2010-08-26 14:37:11 +0200
commit01fcff8f4243e75116986fbb818789f0c138d087 (patch)
tree45fa39860f247cc1682e764747e9ede16aa1c43d /01_Functions.zsh
parente44fcbe4ad82cfb8d83bbd39facb522e1005a61f (diff)
[Git] wrapper to let git work only inside git folders
Diffstat (limited to '01_Functions.zsh')
-rw-r--r--01_Functions.zsh19
1 files changed, 19 insertions, 0 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index a8c5b31..1ccc8d0 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -22,6 +22,25 @@ cmd_exists ()
which -p $1 >/dev/null 2>&1
}
+git () {
+ GIT=$(which -p git)
+ case $1 in
+ init|clone)
+ ;;
+ *)
+ if [ "$( ( $GIT ls-files ; $GIT ls-tree HEAD . ) 2>&- | head -n1)" = ""\
+ -a \( ! -d .git -o "$($GIT rev-parse --git-dir 2>&-)" != ".git" \)\
+ -a "$($GIT rev-parse --is-inside-git-dir 2>&-)" != "true" ]
+ then
+ echo >&2 "Not inside a git folder !"
+ return
+ fi
+ ;;
+ esac
+
+ $(which -p git) $@
+}
+
term_title()
{
# Jobs