don't try to commit if nothing has changed

This commit is contained in:
Jérémy Lecour 2018-09-06 12:22:35 +02:00 committed by Jérémy Lecour
parent 7e5b571fc9
commit ee93e19130

View file

@ -61,10 +61,11 @@ if test -x "${GIT_BIN}"; then
export GIT_DIR="${dir}/.git" GIT_WORK_TREE="${dir}" export GIT_DIR="${dir}/.git" GIT_WORK_TREE="${dir}"
# If the repository and the work tree exist, try to commit changes # If the repository and the work tree exist, try to commit changes
if test -d "${GIT_DIR}" && test -d "${GIT_WORK_TREE}"; then if test -d "${GIT_DIR}" && test -d "${GIT_WORK_TREE}"; then
${GIT_BIN} add --all CHANGED_LINES=$(git status --porcelain | wc -l)
${GIT_BIN} commit --message "${TEXTE}" --author="${USER} <${USER}@evolix.net>" --quiet if [ "${CHANGED_LINES}" != "0" ]; then
# Add the SHA to the log file if something has been committed ${GIT_BIN} add --all
if [ "$?" = "0" ]; then ${GIT_BIN} commit --message "${TEXTE}" --author="${USER} <${USER}@evolix.net>" --quiet
# Add the SHA to the log file if something has been committed
SHA=$(git rev-parse HEAD) SHA=$(git rev-parse HEAD)
echo "${dir} : ${SHA}" >> "${LOGFILE}" echo "${dir} : ${SHA}" >> "${LOGFILE}"
fi fi