#!/bin/sh
# This is a git pre-commit hook that automatically refreshes .akku/lib
# and guile-deps.txt and makes it part of the commit. This is needed
# to keep the project buildable without any bootstrapping problems.
set -eu
rm -rf dist
bin/akku.sps 2>/dev/null || exit 0
echo "Doing git rm/add on dependencies..."
git rm --quiet -r --cached .akku/lib || true
bin/akku.sps install 2>/dev/null
bin/akku.sps dependency-scan --implementation=chezscheme,guile,loko bin/akku.sps | xargs git add -f
git add -f .akku/lib/akku/metadata.sls
git add -f .akku/bin/activate
git add -f .akku/bin/activate.fish
git add -f .akku/env
bin/akku.sps dependency-scan --implementation=guile bin/akku.sps > guile-deps.txt
git add guile-deps.txt
