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 ' ')
|
||||
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}"
|
||||
|
|
Loading…
Reference in a new issue