all repos — shwarp-tools @ 2b9c1d6ae51d70200e6eeea09b3a6869a14aa84d

Tools and scripts

tool(autocommit): check this is a git directory
shwarp
Sun, 30 Aug 2026 15:21:02 -0400
commit

2b9c1d6ae51d70200e6eeea09b3a6869a14aa84d

parent

8deccc5f5900415b4797503206865fdba4d4f0f8

1 files changed, 9 insertions(+), 0 deletions(-)

jump to
M tools/autocommit → tools/autocommit

@@ -16,12 +16,19 @@ FILE=$(basename "$1")

DIRECTORY=$(echo ${1::-"$((${#FILE} + 1))"}) COMMIT_MESSAGE="auto: $FILE changed" +if [ ! -d "$DIRECTORY/.git" ] || ! git -C "$DIRECTORY" rev-parse 2>/dev/null +then + echo "'${DIRECTORY}' must be an initialised GIT directory" +fi + while true do cd "$DIRECTORY" inotifywait -qq -e CLOSE_WRITE "$FILE" + echo -n ? + # Keep duplicate updates out sleep 1s

@@ -29,6 +36,8 @@ git add "$FILE"

# Bail if nothing to commit git diff --cached --quiet && continue + + echo -ne \\r\\a git commit -qm "$COMMIT_MESSAGE"