1
0
Fork 0

Make sign-off configurable

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-11-10 12:44:57 +01:00
parent 400ccb18e9
commit e4cca82e2d
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 13 additions and 14 deletions

View file

@ -1,14 +1,14 @@
#!/bin/bash -e
#!/bin/bash
set -eu
set -o pipefail
set -e
source "${HOME}/bin/script_framework.sh"
### Fix committer email by repo
step "Ensure correct committer email..."
git setmail
step "Ensure correct commit config..."
git committerconfig
### Commit
@ -19,7 +19,8 @@ step "Execute pre-commit auto-hook"
git autohook pre-commit
step "Issuing commit..."
git commit -S -s -v "$@"
COMMIT_OPTS=$(git config --get commit.cliopts 2>/dev/null || echo "")
git commit -v ${COMMIT_OPTS} "$@"
step "Execute post-commit auto-hook"
git autohook post-commit

View file

@ -13,7 +13,7 @@
import sys, re, subprocess, os.path, json
CONFIG=os.path.expanduser('~/.config/git-setmail.json')
CONFIG=os.path.expanduser('~/.config/git-committerconfig.json')
def main():
try:
@ -30,13 +30,11 @@ def main():
for combi in combinations:
if re.search(combi['match'], repo):
if combi['email'] == subprocess.check_output(['git', 'config', 'user.email']).strip():
print 'Email correctly set to "{}", not modifying.'.format(combi['email'])
else:
print 'Found repo "{}", setting email to "{}"...'.format(repo, combi['email'])
subprocess.check_call(['git', 'config', 'user.email', combi['email']])
if 'gpg-key' in combi and combi['gpg-key'] != '':
subprocess.check_call(['git', 'config', 'user.signingkey', combi['gpg-key']])
subprocess.check_call(['git', 'config', '--local', 'user.email', combi['email']])
if 'gpg-key' in combi and combi['gpg-key'] != '':
subprocess.check_call(['git', 'config', '--local', 'user.signingkey', combi['gpg-key']])
if 'commit-opts' in combi:
subprocess.check_call(['git', 'config', '--local', 'commit.cliopts', combi['commit-opts']])
break
return 0

View file

@ -16,7 +16,7 @@ import subprocess
import os.path
import json
CONFIG = os.path.expanduser('~/.config/git-setmail.json')
CONFIG = os.path.expanduser('~/.config/git-committerconfig.json')
def main():