cfg/bin/git-c

37 lines
800 B
Plaintext
Raw Normal View History

2016-07-21 13:48:49 +00:00
#!/bin/bash -e
2016-10-19 15:25:32 +00:00
STEP_COLOR="\033[0;36m"
NO_COLOR="\033[0m"
function step {
echo -e ${STEP_COLOR}[$(date +%H:%M:%S)] $1${NO_COLOR}
}
2016-10-19 15:20:54 +00:00
### Fix committer email by repo
2016-10-19 15:25:32 +00:00
step "Ensure correct committer email..."
git setmail
2016-10-19 15:20:54 +00:00
### Commit
2016-10-19 15:25:32 +00:00
step "Loading passphrase for GPG key..."
vault-gpg $(git config user.signingkey)
2016-10-19 15:25:32 +00:00
step "Execute pre-commit auto-hook"
git autohook pre-commit
2016-10-19 15:25:32 +00:00
step "Issuing commit..."
2016-10-05 15:22:58 +00:00
git commit -S -v "$@"
2016-07-21 13:48:49 +00:00
step "Execute post-commit auto-hook"
git autohook post-commit
2016-10-19 15:20:54 +00:00
### Count productivity habit
2016-10-19 15:25:32 +00:00
step "Recording work..."
2016-07-21 13:48:49 +00:00
PROD_TASK=$(habitica https://habitica.com/api/v3/tasks/user | jq -r '.data | map(select(.text=="productivity").id)[0]')
if ! ( habitica -sS -o /dev/null -X POST https://habitica.com/api/v3/tasks/${PROD_TASK}/score/up ); then
echo "Scoring failed."
fi