Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…) #7

Merged
jlecour merged 61 commits from options into master 2019-03-26 15:14:12 +01:00
Showing only changes of commit 4e2d55ea5e - Show all commits

View file

@ -79,13 +79,11 @@ get_repository_status() {
CHANGED_LINES=$(${GIT_BIN} status --porcelain | wc -l | tr -d ' ')
if [ "${CHANGED_LINES}" != "0" ]; then
STATUS=$(${GIT_BIN} status --short | tail -n 10)
# append diff data, without empty lines
RESULT=$(printf "%s\n%s\n" "${GIT_DIR} (last 10 lines)" "${STATUS}" | sed -e '/^$/d')
printf "%s\n%s\n" "${GIT_DIR} (last 10 lines)" "${STATUS}" | sed -e '/^$/d'
fi
fi
# unset environment variables to prevent accidental influence on other git commands
unset GIT_DIR GIT_WORK_TREE
echo "${RESULT}"
}
hook_commit() {
@ -212,9 +210,12 @@ if test -x "${GIT_BIN}"; then
for dir in ${GIT_REPOSITORIES}; do
RESULT=$(get_repository_status "${dir}")
if test -n "${RESULT}"; then
# append diff data, without empty lines
GIT_STATUSES=$(printf "%s\n%s\n" "${GIT_STATUSES}" "${RESULT}" | sed -e '/^$/d')
fi
unset RESULT
done
if test -n "${GIT_STATUSES}"; then
echo "/!\ There are some uncommited changes. If you proceed, everything will be commited."
echo "${GIT_STATUSES}"