diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-22 14:14:28 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-22 14:14:28 -0400 |
commit | 5df9d1b98787303f724dfc4e6f423d6e2817aac3 (patch) | |
tree | 15c576d9e29116e1e42b65679b2198853dd3067e /commit.d/50vcs-commit | |
parent | 1490c8d6dd94f1b58718f6bc61ba78cf8a0a2e26 (diff) |
Support ~/.config/git/config when determining the author name and email. Thanks, Richard Savio
Diffstat (limited to 'commit.d/50vcs-commit')
-rwxr-xr-x | commit.d/50vcs-commit | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit index 89aa6c6..55f0db2 100755 --- a/commit.d/50vcs-commit +++ b/commit.d/50vcs-commit @@ -55,11 +55,23 @@ if [ "$VCS" = git ] && [ -d .git ]; then export GIT_AUTHOR_EMAIL fi fi + if [ -z "$GIT_AUTHOR_NAME" ] || [ -z "$GIT_AUTHOR_EMAIL" ]; then + if [ -n "$USER_HOME" ] && [ -e "$USER_HOME/.config/git/config" ]; then + if [ -z "$GIT_AUTHOR_NAME" ]; then + GIT_AUTHOR_NAME="$(git config -f "$USER_HOME/.config/git/config" user.name)" || true + export GIT_AUTHOR_NAME + fi + if [ -z "$GIT_AUTHOR_EMAIL" ]; then + GIT_AUTHOR_EMAIL="$(git config -f "$USER_HOME/.config/git/config" user.email)" || true + export GIT_AUTHOR_EMAIL + fi + fi + fi + if [ -z "$GIT_COMMITTER_EMAIL" ]; then GIT_COMMITTER_EMAIL="$(git config --global user.email)" || true export GIT_COMMITTER_EMAIL fi - if [ -z "$GIT_AUTHOR_NAME" ]; then GIT_AUTHOR_NAME="$USER" export GIT_AUTHOR_NAME |