aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKosta Harlan <kostajh@gmail.com>2013-09-02 16:54:02 -0400
committerKosta Harlan <kostajh@gmail.com>2013-09-02 16:54:02 -0400
commite9ec91594ad3c722be13ffb069184ad65626cdc5 (patch)
treedfae9742778fd386fb7cb774db96b2c592d7b2f2
parent9b7388a4a748067a2fe631ed15eff1ed8dfdf385 (diff)
downloadtask-git-e9ec91594ad3c722be13ffb069184ad65626cdc5.tar.xz
task-git-e9ec91594ad3c722be13ffb069184ad65626cdc5.zip
Remove task-git-push from arguments if set
-rwxr-xr-xtask-git.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/task-git.sh b/task-git.sh
index 620e197..26af83d 100755
--- a/task-git.sh
+++ b/task-git.sh
@@ -11,16 +11,24 @@ if [ ! -d "$DATA_DIR" ]; then
exit 1
fi
-# Create backups
-/usr/bin/task $@
-cd $DATA_DIR
-git add .
-git commit -m "$TASK_COMMAND" > /dev/null
# Check if --task-git-push is passed as an argument.
+PUSH=0
for i
do
if [ "$i" == "--task-git-push" ]; then
- git push origin master
+ # Set the PUSH flag, and remove this from the arguments list.
+ PUSH=1
+ shift
fi
done
+
+# Call task, commit files and push if flag is set.
+/usr/bin/task $@
+cd $DATA_DIR
+git add .
+git commit -m "$TASK_COMMAND" > /dev/null
+
+if [ "$PUSH" == 1 ]; then
+ git push origin master > /dev/null
+fi
exit 0