aboutsummaryrefslogtreecommitdiff
path: root/commit
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-09-16 18:57:16 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-09-16 18:57:16 -0300
commitf353440268647fc4d600ac71f0706cc9e54c2168 (patch)
treea198d27aaa08698dbee369866a4a4221393adaa2 /commit
parent7d889c0767d44d070628ad708ed640f1f8d9a7ce (diff)
downloadutils-git-f353440268647fc4d600ac71f0706cc9e54c2168.tar.gz
utils-git-f353440268647fc4d600ac71f0706cc9e54c2168.tar.bz2
Adds hit, the git interceptor
Diffstat (limited to 'commit')
-rwxr-xr-xcommit17
1 files changed, 10 insertions, 7 deletions
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 <file>
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