From f353440268647fc4d600ac71f0706cc9e54c2168 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 16 Sep 2017 18:57:16 -0300 Subject: Adds hit, the git interceptor --- commit | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'commit') diff --git a/commit b/commit index e7026b6..0b998b0 100755 --- a/commit +++ b/commit @@ -6,6 +6,9 @@ # Parameters ARGS="$*" +# Git application we use +GIT="hit" + # Check if a file is inside a git repository # Usage: git_folder function git_folder { @@ -51,7 +54,7 @@ function is_git { elif [ -d "$1/.git" ]; then return else - ( cd "$1" && git status &> /dev/null ) + ( cd "$1" && $GIT status &> /dev/null ) if [ "$?" != "128" ]; then return @@ -77,12 +80,12 @@ function is_svn { function git_push { if [ "`git remote | wc -l`" == "0" ]; then return - elif git remote | grep -q 'all'; then - git push all --all + elif $GIT remote | grep -q 'all'; then + $GIT push all --all #elif git remote | grep -q 'origin'; then # echo "Please configure the 'all' remote first." # exit 1 - # #git push --all + # #$GIT push --all fi } @@ -130,13 +133,13 @@ function git_commit { # If there are no staged files, commit everything. # Otherwise commit just what was staged - if git status --short | grep -q "^[AM]"; then + if $GIT status --short | grep -q "^[AM]"; then flag="" else flag="-a" fi - git commit $flag -m "$params" + $GIT commit $flag -m "$params" } # Main @@ -150,6 +153,6 @@ if [ ! -z "$1" ]; then git_user git_commit $* git_push - git fetch --all + $GIT fetch --all fi fi -- cgit v1.2.3