From a890ac4a2ca4c9580b4a2e3a0c84f0ba249867dc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 22 Jul 2013 11:24:10 -0400 Subject: Use user.name and user.email from the .gitconfig file belonging to the user who sued or sudoed to root, in preference to making up values for that user. --- commit.d/50vcs-commit | 15 +++++++++++++++ debian/changelog | 3 +++ etckeeper.spec | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit index d484626..a700589 100755 --- a/commit.d/50vcs-commit +++ b/commit.d/50vcs-commit @@ -41,6 +41,21 @@ fi if [ "$VCS" = git ] && [ -d .git ]; then if [ -n "$USER" ]; then + # Use user.name and user.email from the gitconfig belonging + # to the user who became root. + USER_HOME="$(perl -e 'print ((getpwnam("joey"))[7])')" + if [ -n "$USER_HOME" ] && [ -e "$USER_HOME/.gitconfig" ]; then + if [ -z "$GIT_AUTHOR_NAME" ]; then + GIT_AUTHOR_NAME=$(git config -f "$USER_HOME/.gitconfig" user.name) + fi + if [ -z "$GIT_AUTHOR_EMAIL" ]; then + GIT_AUTHOR_EMAIL=$(git config -f "$USER_HOME/.gitconfig" user.email) + fi + fi + if [ -z "$GIT_COMMITTER_EMAIL" ]; then + GIT_COMMITER_EMAIL="$(git config --global user.email)" + fi + if [ -z "$GIT_AUTHOR_NAME" ]; then export GIT_AUTHOR_NAME="$USER" fi diff --git a/debian/changelog b/debian/changelog index fce5080..3dfc62f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ etckeeper (1.5) UNRELEASED; urgency=low in one was not a bloody stupid idea. * Added support for the pacman package manager. (Thanks, Tiago Stürmer Daitx) + * Use user.name and user.email from the .gitconfig file belonging to the + user who sued or sudoed to root, in preference to making up values for + that user. -- Joey Hess Wed, 26 Jun 2013 13:15:03 -0400 diff --git a/etckeeper.spec b/etckeeper.spec index ad43b5f..cd23318 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -1,5 +1,5 @@ Name: etckeeper -Version: 1.4 +Version: 1.5 Release: 4%{?dist} Summary: store /etc in git, mercurial, bzr or darcs -- cgit v1.2.3