From 2d44cda4de71ea65d3524e990ee0ddc5f3601ed3 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Fri, 1 May 2026 10:16:33 +0100 Subject: [PATCH] Fixed issue with git pulls on flake.lock --- justfile | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/justfile b/justfile index 86d6c5e..ef067f3 100644 --- a/justfile +++ b/justfile @@ -10,11 +10,20 @@ default: _git-sync: @if [ -n "$(git status --porcelain)" ]; then \ - echo ">> Stashing local changes..."; \ - git stash; \ - git pull --ff-only --recurse-submodules; \ - git submodule update --remote --recursive; \ - git stash pop; \ + if git status --porcelain | grep -q "flake.lock"; then \ + echo ">> flake.lock is dirty. Resetting to avoid pull conflicts..."; \ + git checkout flake.lock; \ + fi; \ + if [ -n "$(git status --porcelain)" ]; then \ + echo ">> Stashing remaining local changes..."; \ + git stash; \ + git pull --ff-only --recurse-submodules; \ + git submodule update --remote --recursive; \ + git stash pop; \ + else \ + git pull --ff-only --recurse-submodules; \ + git submodule update --remote --recursive; \ + fi; \ else \ git pull --ff-only --recurse-submodules; \ git submodule update --remote --recursive; \ @@ -23,6 +32,11 @@ _git-sync: _flake-update: nix flake update +# Safely commit the lockfile changes +commit-lock: + git add flake.lock + git commit -m "chore: update flake.lock" || echo "No changes to commit" + # Sync git and update flake inputs (override with git=false or flake=false) prebuild: @if [ "{{git}}" == "true" ]; then \