dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit cef477a65d0cd3d2020d9f8d1332bfb5403065f4
parent a3c96e08e2ba8b55edaa9b63662c8212622bd2af
Author: hhvn <dev@haydenvh.com>
Date:   Sun,  7 Mar 2021 23:56:34 +0000

.config/git/add-commit: git-add only if commit changed

Diffstat:
M.config/git/add-commit | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/.config/git/add-commit b/.config/git/add-commit @@ -33,19 +33,19 @@ done # in non-inline mode, take list of files to add # then format these into the COMMIT_EDITMSG file - list="$@" - while [ $# -ne 0 ] - do - printf "%s\0" "$1" - shift - done | xargs -0 git add || exit 1 - - echo "$list:" > .git/COMMIT_EDITMSG + echo "$@:" > .git/COMMIT_EDITMSG sum=$(sha256sum .git/COMMIT_EDITMSG) ${EDITOR:-vim} .git/COMMIT_EDITMSG sum2=$(sha256sum .git/COMMIT_EDITMSG) - [ "$sum" != "$sum2" ] && git commit -F .git/COMMIT_EDITMSG || { + [ "$sum" != "$sum2" ] && { + while [ $# -ne 0 ] + do + printf "%s\0" "$1" + shift + done | xargs -0 git add || exit 1 + git commit -F .git/COMMIT_EDITMSG + } || { echo "error: COMMIT_EDITMSG not changed" exit 1 }