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