Commit Graph

29 Commits

Author SHA1 Message Date
78e254251a hooks:pre-push: Don't use variables in format string
Link: https://www.shellcheck.net/wiki/SC2059
2025-03-04 12:55:50 +01:00
78464fdfb0 hooks:pre-push: Allow WIP commits on WIP branches 2025-03-03 18:27:46 +01:00
09a7497432 hooks:commit-msg: Visually separate error message
The warning is quickly overread when in the same paragraph as git's
normal output.
2024-10-16 14:53:39 +02:00
0a12cd58ed hooks:commit-msg: Source helpers directly from repo 2024-10-16 14:53:39 +02:00
a376ff7b78 hooks:commit-msg: Relax subject length limit to 60
There is no need to be that pedantic.
2024-10-16 14:53:27 +02:00
b82405a8c0 meta:commit-msg: Allow all characters in prefix
There is no real reason for a restriction.

Also merge the two character groups.
2022-10-21 00:49:17 +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
329a6e6eca meta:commit-msg: Allow subject to start with quote
See previous commit (d44931df8 "meta:envrc: `git fetch` in background").
2022-08-30 19:52:23 +02:00
b9ac80551c meta:hooks:pre-push: Format printout
Forgot some newlines.
2022-07-12 21:00:13 +02:00
e40ee88520 meta:hooks:pre-push: Refactor if-condition 2022-07-12 21:00:13 +02:00
45cb607385 meta:hooks:pre-push: Adjust to more concise style
Adjust the sample code from git to a more concise coding style, placing
{do,then} on the same line and using `[` instead of `test`.
2022-07-12 21:00:13 +02:00
ee6153734a meta:hooks:pre-push: Extend pattern for autosquash
Extend the grep pattern for commits starting with `{squash,fixup}!`.
2022-07-12 21:00:12 +02:00
f4fe825ce7 meta:git:hooks: Add pre-push template 2022-07-12 21:00:12 +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
b96d32996b *: Wrap lines at 80 columns where appropriate
Wrap lines at 80 columns where appropriate and I had the energy to think
about how/where to wrap.

There are still lines longer than that, which I plan to wrap in the
future. But that is enough for now.
2022-06-23 23:59:00 +02:00
f620e6d577 meta:hooks:commit-msg: Improve body recognition
Before, the commit-msg hook would not catch too long lines when
squashing commits, as the provided message starts immediately with a
commented line.

Instead of simply using all lines until the first comment, use all lines
until git's cut-line and remove all commented lines in between.

Do not hard-code git's commentary character but rather use
`core.commentChar`. `auto` is depending of the context interpreted as
'any character' or `#`.
2022-06-23 23:58:34 +02:00
7126a40c71 meta:hooks:commit-msg: Allow {fixup,squash} prefix
Allow the "fixup! " and "squash! " prefix' created by the
`--fixup`/`--squash` flags to `git-commit`
2022-06-23 23:58:33 +02:00
b1d396babd *: Use /usr/bin/env in shebangs for bash & zsh
To increase the portability (OSX for example has zsh under `/bin/zsh`).
2021-07-14 13:48:21 +02:00
9a7c5e6c47 meta:git-hooks:commit-msg: Fix typo
I have no idea how I have not noticed this yet, as apparently every time
I wrote a commit message that contains a body and not just a subject I
got an error message complaining that the first word does not exist as a
command. (With the exception of when it actually is, but then executing
arbitrary code)
2021-06-30 12:51:29 +02:00
03b6ba72ae meta:hooks:commit-msg: Break on first comment
Because `git diff --staged -u | head -1` returns nothing when rebasing
the hook checked the line length of the commit changes (verbose commit).
2020-12-23 19:45:56 +01:00
druckdev
6cac0dc53a git: Show patch of the changes in commit message
The changes are only shown in the editor and do not land in the final
commit message.

For that setting the git-commit-last-msg function and the commit-msg
hook had to be updated.
The function is now a standalone function instead of anonymous and
uses every line until the first comment in COMMIT_EDITMSG discarding the
new information too.
The hook breaks now when checking line lengths when the changes start
since for some weird reason they are passed together with the rest of
the message instead of being deleted like the comments.
2020-11-23 01:27:51 +01:00
druckdev
67c30e9842 meta:hooks:commit-msg: Allow dots and slashes
Allow dots and slashes in the program specification in the subject.
2020-10-26 15:04:20 +01:00
druckdev
0db8155002 meta:hooks: Refactor commit-msg (sh -> bash)
Refactor commit-msg to reduce redundancies by splitting up the pattern
into the different 'levels'.
For the array the change from /bin/sh to /bin/bash was necessary.
Because of that: Change all `test` occurrences to [[ ]] for performance.
2020-10-26 15:00:38 +01: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
druckdev
552b467102 meta:commit-msg-hook: Add more special characters 2020-10-10 13:26:42 +02:00
druckdev
9bb96e26e7 git:hook:commit-msg: Allow capitals and numbers
Allow capitals and numbers in the program name specification in the
subject line.
2020-10-06 00:59:13 +02:00
druckdev
d0da230266 git:hook:commit-msg: Allow some special characters
Allow some special character in the program name specification in the
subject line.
2020-10-03 01:30:04 +02:00
druckdev
10c8d7097a meta: Add commit-msg git hook 2020-09-25 02:27:57 +02:00