summaryrefslogtreecommitdiff
path: root/Omni/Ide/hooks
AgeCommit message (Collapse)Author
2025-09-05Strip comment lines and diff in commit-msg hookBen Sima
Without this, my custom git commit template will get mangled into the commit message with the call to fmt. I guess git strips all of this stuff *after* it runs the commit-msg hook. Oy vey. diff --git a/Omni/Ide/hooks/commit-msg b/Omni/Ide/hooks/commit-msg index c15b4a1..bfbb06f 100755 --- a/Omni/Ide/hooks/commit-msg +++ b/Omni/Ide/hooks/commit-msg @@ -1,6 +1,7 @@ #!/usr/bin/env bash temp=$(mktemp) -fmt -w 72 -u "$1" > "$temp" +# strip comment lines and everything after >8 cut line +sed '/^#/d; /^# -\+ >8 -\+/,$d' "$1" | fmt -w 72 -u > "$temp" mv "$temp" "$1" if ! gitlint --ignore-stdin --staged --msg-filename "$1" run-hook; then backup="$CODEROOT"/.git/COMMIT_EDITMSG.backup
2025-09-05Fix fmt spacingBen Sima
The -s and -u flags tell fmt to fill the paragraph by merging lines. Without this, fmt might just add line breaks, and this is no good.
2025-09-04Wrap all commit messages with fmtBen Sima
Sometimes aider will write commit messages without wrapping them at 80 chars, and then the commit fails the gitlint hook, and aider can't finish the commit. To fix this I can just auto-wrap before we check it.
2024-12-21Add shebangs and x bit to executablesBen Sima
With run.sh, we can build and run the file in one go. This means we can also use it as an interpreter in a shebang line and properly use the Unix executable bit. This is pretty cool and gives a few advantages: running any executable file is just `exec file.hs` or even `./file.hs`, finding all executables is `fd -t x`, you don't need to specify or know an `out` name to run something, execution of a program is standardized. There is a hack to get this to work. In C and Common Lisp, `#!` is illegal syntax, so I had to use shell syntax to invoke run.sh, call it on the current file, and then exit the shell script. Meanwhile, run.sh takes the file and evals the whole thing, building and running it. As long as either `//` or `;` is a comment character in the target language, then this works. Maybe a better thing to do would be to pre-process the file and remove the `#!` before passing it to the C compiler, like [ryanmjacobs/c][1] and [tcc][2]? However this won't work in Lisp because then I can't just load the file directly into the repl, so maybe the comment hack needs to stay. [1]: https://github.com/ryanmjacobs/c/tree/master [2]: https://repo.or.cz/tinycc.git/blob/HEAD:/tccrun.c
2024-12-21Re-namespace some stuff to OmniBen Sima
I was getting confused about what is a product and what is internal infrastructure; I think it is good to keep those things separate. So I moved a bunch of stuff to an Omni namespace, actually most stuff went there. Only things that are explicitly external products are still in the Biz namespace.