Skip to content

Commit

Permalink
chore: add git subtree helper to dev shell
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Feb 21, 2025
1 parent f9d11a3 commit 2633a58
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,40 @@
default = let
pkgs = pkgsFor.${system};
libs = with pkgs; [openssl xz bzip2];
git-subtree-cmd =
pkgs.writeShellScriptBin "git-subtree"
/*
bash
*/
''
SUBTREE="$1"
CMD="$2"
REF="$3"
declare -A prefixes
prefixes=(
["minisat"]="minisat/cppsrc"
["glucose"]="glucose/cppsrc"
["cadical"]="cadical/cppsrc"
["kissat"]="kissat/csrc"
)
case $CMD in
pull)
echo "Pulling subtree $SUBTREE from ref $REF"
git subtree pull --prefix "''${prefixes[$SUBTREE]}" "$SUBTREE" "$REF" --squash -m "chore($SUBTREE): update subtree"
;;
push)
echo "Pushing subtree $SUBTREE to ref $REF"
git subtree push --prefix "''${prefixes[$SUBTREE]}" "$SUBTREE" "$REF"
;;
*)
2>&1 echo "Unknown command $CMD"
2>&1 echo "Usage: git-subtree <subtree> <command> <ref>"
esac
'';
in
pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} rec {
inherit (self.checks.${system}.pre-commit-check) shellHook;
Expand All @@ -60,6 +94,7 @@
jq
maturin
kani
git-subtree-cmd
]
++ self.checks.${system}.pre-commit-check.enabledPackages;
buildInputs = libs;
Expand Down

0 comments on commit 2633a58

Please sign in to comment.