Commit Graph

11 Commits

Author SHA1 Message Date
7f83427749 hooks:pre-commit: Broken link detection on delete
Until now the hook only checked newly added symlinks. This patch is a
first draft of also checking the worktree and index for any dangling
symlinks after staging a deletion.

The whole thing probably breaks when file-names contain newlines and
maybe also a mix of quotes. I plan on making this more robust in the
future but see no urgency for it since this repository has pretty simple
filenames.
2025-09-15 17:40:35 +02:00
8a4029121e hooks:pre-commit: Explicitly propagate pipe error
The `die` in the pipe does not exit the whole script but only the pipe.
This currently works because the pipe is the last thing being executed.
If something would come after the pipe, the hook would happily continue
executing. Properly propagate the exit to prevent this in the future.
2025-09-15 17:34:01 +02:00
3eb9113546 hooks:pre-commit: Remove bashisms 2025-06-27 11:35:32 +02:00
d4d21ceb1d hooks:pre-commit: Update to git's current version
The template has changed since I've added it.
2025-05-30 01:21:48 +02:00
4fba1bbf13 hooks:pre-commit: Fix symlink diff-filter
Renames are uninteresting for the link check. But we do care about
change in the type of the file.
2025-05-30 00:53:52 +02:00
a37080c948 hooks:pre-commit: Check for absolute links too
I don't really want any absolute links here.
2025-05-30 00:51:41 +02:00
88be20672a hooks:pre-commit: Fix non-tab indentation 2025-05-30 00:37:29 +02:00
7666086dba *: Move die() into .local/bin/helpers.sh
The function `die` was redundantly implemented in various files.

Move the function into .local/bin/helpers.sh and source that where
previously implemented.

Also prepend the program's name to the message and always terminate the
message with a newline. The newline was previously needed for a small
but unnecessary hack that prevented the need of the `[ -z "$1" ]` test.
2022-09-22 14:39:20 +02:00
6c802cc70f meta:hooks:pre-commit: Check for broken symlinks
Check that added/moved symlinks are not broken.
2022-07-12 21:00:02 +02:00
druckdev
3c6c37f235 meta:hooks: Refactor pre-commit + check renaming
Refactor the script to match my coding style more and update the
comments.
When checking the filenames for non-ASCII characters, check also
renaming of files instead of only additions.
2020-10-24 20:04:30 +02:00
druckdev
07a9f80c19 meta:hooks: Add pre-commit example script 2020-10-24 19:34:47 +02:00