From fc01d900b76e72d45a862b2b2a2e38026429ff74 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Thu, 20 Mar 2025 13:27:44 +0100 Subject: [PATCH] env --- .envrc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.envrc b/.envrc index df41b25..64e10c1 100644 --- a/.envrc +++ b/.envrc @@ -15,23 +15,23 @@ now="$(date +%Y-%m-%d)" if [[ ! -d .direnv/tmp ]]; then mkdir -p .direnv/tmp elif command -v find >/dev/null; then - find .direnv/tmp/ -mindepth 1 -maxdepth 1 -type d -and ! -newermt "4 hours ago" -delete + find .direnv/tmp/ -mindepth 1 -maxdepth 1 -type d -and ! -newermt "4 hours ago" -exec rm -rf {} \; fi if [[ ! -s .direnv/pull-date || "$now" != "$(cat .direnv/pull-date)" ]]; then tmp=$(mktemp -p .direnv/tmp -d) trap 'rm -rf "$tmp" >&/dev/null' ERR EXIT RETURN - if ! $GIT diff --exit-code --quiet HEAD -- flake.lock >&/dev/null; then + if ! git diff --exit-code --quiet HEAD -- flake.lock >&/dev/null; then cp flake.lock "$tmp"/dirty-flake.lock - $GIT reset -- flake.lock - $GIT restore -- flake.lock - cp flake.lock "$tmp"/clean-flake.lock # we could instead preserve the current $GIT rev + git reset -- flake.lock + git restore -- flake.lock + cp flake.lock "$tmp"/clean-flake.lock # we could instead preserve the current git rev fi - $GIT pull --rebase --autostash + git pull --rebase --autostash if grep -q "^=======" flake.lock; then # TODO: can this happen anymore? - $GIT reset -- flake.lock + git reset -- flake.lock rm flake.lock # restore? - $GIT checkout -- flake.lock + git checkout -- flake.lock elif [[ -s "$tmp"/clean-flake.lock ]] && ! diff -q "$tmp"/clean-flake.lock flake.lock >&/dev/null; then cp "$tmp"/flake-dirty.lock flake.lock fi