dotfiles

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

commit 3d38778a7767faeb37b2092b6d93a371d94726ca
parent ae057de2dfdf052a51abf00d8ef1a158dc720692
Author: hhvn <dev@haydenvh.com>
Date:   Mon,  8 Mar 2021 17:18:31 +0000

.c/g/add-commit: shorten dir names, in commit msgs

Diffstat:
M.config/git/add-commit | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.config/git/add-commit b/.config/git/add-commit @@ -3,6 +3,8 @@ # example: git ac -m "LICENSE project.c: new email addr" # output: git add LICENSE project.c; git commit -m "LICENSE project.c: new email addr" +shorten=y + die(){ echo "error: no filenames extracted from commit message" exit 1 @@ -33,7 +35,9 @@ done # in non-inline mode, take list of files to add # then format these into the COMMIT_EDITMSG file - echo "$@:" > .git/COMMIT_EDITMSG + [ "$shorten" = "y" ] && { + echo "$@:" | sed -E 's~([a-zA-Z])[^/]*/~\1/~g' > .git/COMMIT_EDITMSG + } || echo "$@:" > .git/COMMIT_EDITMSG sum=$(sha256sum .git/COMMIT_EDITMSG) ${EDITOR:-vim} .git/COMMIT_EDITMSG sum2=$(sha256sum .git/COMMIT_EDITMSG)