diff options
Diffstat (limited to '01_Functions.zsh')
-rw-r--r-- | 01_Functions.zsh | 19 |
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 |