fixed git commit author

This commit is contained in:
Nicolas Roman 2019-02-14 14:53:12 +01:00
parent 0621f62267
commit f12d31bb82
1 changed files with 4 additions and 1 deletions

View File

@ -97,6 +97,9 @@ GIT_REPOSITORIES="/etc /etc/bind"
# git statuses
GIT_STATUSES=""
# current user of sudo, or root if not defined
[ $SUDO_USER ] && CURR_USER=$SUDO_USER || CURR_USER=$USER
if test -x "${GIT_BIN}"; then
# loop on possible directories managed by GIT
for dir in ${GIT_REPOSITORIES}; do
@ -164,7 +167,7 @@ if test -x "${GIT_BIN}"; then
CHANGED_LINES=$(${GIT_BIN} status --porcelain | wc -l | tr -d ' ')
if [ "${CHANGED_LINES}" != "0" ]; then
${GIT_BIN} add --all
${GIT_BIN} commit --message "${TEXTE}" --author="${USER} <${USER}@evolix.net>" --quiet
${GIT_BIN} commit --message "${TEXTE}" --author="${CURR_USER} <${CURR_USER}@evolix.net>" --quiet
# Add the SHA to the log file if something has been committed
SHA=$(${GIT_BIN} rev-parse --short HEAD)
STATS=$(${GIT_BIN} show --stat | tail -1)