Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
just: Introduce task manager for git hooks
Merged ade opened 22 days ago

As part of discussions around task runners for Radicle, just became a candidate over make and a few others due to its focus solely on task running and no build system.

This patch introduces just as a git hook task runner and manager. We previously managed hooks with the flake.nix which is great for nix users but not the wider community.

Further discussion was had around pre-commit as the flake.nix could be converted to a pre-commit config, however it was decided this would prevent non-nix users from contributing to the git hooks system easily.

In this patch we introduce a justfile with commands for all previous git hook checks from flake.nix.

We also introduce a git-hook-template.sh which is a thin shim over the just commands for each hook: pre-commit, post-checkout, pre-push. The shim checks a set of ‘sensitive’ files against master and if there are changes, warns the users and has them explicitly consent to running hook commands. This should provide a safety barrier for smuggled git hook overrides in large patches that may cause arbitrary code execution on reviewers machines.

ade opened with revision 0fefd5bb on base 48551cde +254 -5 22 days ago

As part of discussions around task runners for Radicle, just became a candidate over make and a few others due to its focus solely on task running and no build system.

This patch introduces just as a git hook task runner and manager. We previously managed hooks with the flake.nix which is great for nix users but not the wider community.

Further discussion was had around pre-commit as the flake.nix could be converted to a pre-commit config, however it was decided this would prevent non-nix users from contributing to the git hooks system easily.

In this patch we introduce a justfile with commands for all previous git hook checks from flake.nix.

We also introduce a git-hook-template.sh which is a thin shim over the just commands for each hook: pre-commit, post-checkout, pre-push. The shim checks a set of ‘sensitive’ files against master and if there are changes, warns the users and has them explicitly consent to running hook commands. This should provide a safety barrier for smuggled git hook overrides in large patches that may cause arbitrary code execution on reviewers machines.

ade pushed revision 2 46c288d2 on base 48551cde +282 -9 21 days ago
levitte reviewed · 2 comments 21 days ago

I’ve a couple of nits (see line comments in justfile)

ade pushed revision 3 3c472a83 on base 48551cde +283 -9 21 days ago
fintohaps pushed revision 4 f9cc5e42 on base 48551cde +286 -9 15 days ago

REVIEW

Added review commits with a few improvements.

Also added codespell to the flake.nix.

ade pushed revision 5 ee0071ee on base 48551cde +285 -9 15 days ago

just: Use full argument names for codespell

just: Expand shellcheck glob to all shell scripts

just: Check for file before removing in install-hooks

The rm command would fail if the hook did not exist. First check for existence and then remove.

just: Add minimum version to CONTRIBUTING and HACKING

fintohaps pushed revision 6 cda2789e on base 48551cde +287 -9 15 days ago

Changes:

  • Added confirmation via bash
  • Added back the change for flake.nix
ade pushed revision 7 29069f7d on base 48551cde +287 -9 15 days ago

just: Use bash to perform install-hook confirmation

The [confirm()] tag had issues on linux with string interpolation, switches to using a bash based read for confirmation.

flake: Add codespell

Nix users may not have codespell installed globally. Introduce it in the devShell so they have it locally in heartwood.

lorenz pushed revision 8 a9cb2891 on base 48551cde +280 -9 14 days ago

Review

fintohaps pushed revision 9 f5bca8e3 on base 48551cde +286 -10 14 days ago

REVIEW

Add rule for elipses in codespell and typos

ade pushed revision 10 dc622911 on base 48551cde +332 -10 14 days ago
fintohaps pushed revision 11 5ca24737 on base 48551cde +338 -10 13 days ago

Changes:

  • Use BASE_BRANCH in checking for changed files
  • There were conflict markers in ade’s previous revision, him and I fixed this interactively.
fintohaps pushed revision 12 5712b9a5 on base 48551cde +347 -10 13 days ago

Changes:

  • Add check for conflict markers
fintohaps pushed revision 13 e7a675ee on base 430868ff +342 -5 13 days ago

Rebase

fintohaps merged revision e7a675ee at 07c62449 13 days ago