Make sign-off configurable
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
400ccb18e9
commit
e4cca82e2d
3 changed files with 13 additions and 14 deletions
11
bin/git-c
11
bin/git-c
|
@ -1,14 +1,14 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
set -e
|
|
||||||
|
|
||||||
source "${HOME}/bin/script_framework.sh"
|
source "${HOME}/bin/script_framework.sh"
|
||||||
|
|
||||||
### Fix committer email by repo
|
### Fix committer email by repo
|
||||||
|
|
||||||
step "Ensure correct committer email..."
|
step "Ensure correct commit config..."
|
||||||
git setmail
|
git committerconfig
|
||||||
|
|
||||||
### Commit
|
### Commit
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ step "Execute pre-commit auto-hook"
|
||||||
git autohook pre-commit
|
git autohook pre-commit
|
||||||
|
|
||||||
step "Issuing 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"
|
step "Execute post-commit auto-hook"
|
||||||
git autohook post-commit
|
git autohook post-commit
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
import sys, re, subprocess, os.path, json
|
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():
|
def main():
|
||||||
try:
|
try:
|
||||||
|
@ -30,13 +30,11 @@ def main():
|
||||||
|
|
||||||
for combi in combinations:
|
for combi in combinations:
|
||||||
if re.search(combi['match'], repo):
|
if re.search(combi['match'], repo):
|
||||||
if combi['email'] == subprocess.check_output(['git', 'config', 'user.email']).strip():
|
subprocess.check_call(['git', 'config', '--local', 'user.email', combi['email']])
|
||||||
print 'Email correctly set to "{}", not modifying.'.format(combi['email'])
|
if 'gpg-key' in combi and combi['gpg-key'] != '':
|
||||||
else:
|
subprocess.check_call(['git', 'config', '--local', 'user.signingkey', combi['gpg-key']])
|
||||||
print 'Found repo "{}", setting email to "{}"...'.format(repo, combi['email'])
|
if 'commit-opts' in combi:
|
||||||
subprocess.check_call(['git', 'config', 'user.email', combi['email']])
|
subprocess.check_call(['git', 'config', '--local', 'commit.cliopts', combi['commit-opts']])
|
||||||
if 'gpg-key' in combi and combi['gpg-key'] != '':
|
|
||||||
subprocess.check_call(['git', 'config', 'user.signingkey', combi['gpg-key']])
|
|
||||||
break
|
break
|
||||||
|
|
||||||
return 0
|
return 0
|
|
@ -16,7 +16,7 @@ import subprocess
|
||||||
import os.path
|
import os.path
|
||||||
import json
|
import json
|
||||||
|
|
||||||
CONFIG = os.path.expanduser('~/.config/git-setmail.json')
|
CONFIG = os.path.expanduser('~/.config/git-committerconfig.json')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue