-
-
Save Ridermansb/9028052da8ca0d8b7977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# copyright 2014 Renato Alves | |
# distributed under the GPL licence | |
if [ -z "$TASKDIR" ]; then | |
#TODO Look for data location in rc:location instead of assuming ~/.taskrc | |
TASKDIR="$(grep data.location $HOME/.taskrc | cut -d '=' -f 2)" | |
fi | |
if [ -z "$TASKBIN" ]; then | |
TASKBIN="task" | |
fi | |
$TASKBIN "$@" | |
EXITCODE="$?" | |
if [ -d "$TASKDIR" ]; then | |
cd "$TASKDIR" | |
else | |
echo "Couldn't navigate to TASKDIR: $TASKDIR" | |
exit $EXITCODE | |
fi | |
if ! [ -d "$TASKDIR/.git" ]; then | |
git init 2>&1 > git.log | |
echo "git.log" > .gitignore | |
echo "git.log.old" >> .gitignore | |
echo "*.pem" >> .gitignore | |
git add .gitignore 2>&1 >> git.log | |
git add *.data *.theme 2>&1 >> git.log | |
git commit -a -m "Initial log" 2>&1 >> git.log | |
fi | |
if [ "$#" -gt "0" ]; then | |
git add *.data *.theme 2>&1 >> git.log | |
git commit -a -m "$*" 2>&1 >> git.log | |
fi | |
# Rotate git.log if bigger than 1M | |
if [ "$(stat -c '%s' git.log)" -gt "1000000" ]; then | |
mv -f git.log git.log.old | |
touch git.log | |
fi | |
exit $EXITCODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment