mirror of
https://github.com/Cian-H/My_NixOS_Config.git
synced 2026-05-14 17:11:42 +01:00
Fixed issue with git pulls on flake.lock
This commit is contained in:
@@ -10,11 +10,20 @@ default:
|
|||||||
|
|
||||||
_git-sync:
|
_git-sync:
|
||||||
@if [ -n "$(git status --porcelain)" ]; then \
|
@if [ -n "$(git status --porcelain)" ]; then \
|
||||||
echo ">> Stashing local changes..."; \
|
if git status --porcelain | grep -q "flake.lock"; then \
|
||||||
git stash; \
|
echo ">> flake.lock is dirty. Resetting to avoid pull conflicts..."; \
|
||||||
git pull --ff-only --recurse-submodules; \
|
git checkout flake.lock; \
|
||||||
git submodule update --remote --recursive; \
|
fi; \
|
||||||
git stash pop; \
|
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 \
|
else \
|
||||||
git pull --ff-only --recurse-submodules; \
|
git pull --ff-only --recurse-submodules; \
|
||||||
git submodule update --remote --recursive; \
|
git submodule update --remote --recursive; \
|
||||||
@@ -23,6 +32,11 @@ _git-sync:
|
|||||||
_flake-update:
|
_flake-update:
|
||||||
nix 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)
|
# Sync git and update flake inputs (override with git=false or flake=false)
|
||||||
prebuild:
|
prebuild:
|
||||||
@if [ "{{git}}" == "true" ]; then \
|
@if [ "{{git}}" == "true" ]; then \
|
||||||
|
|||||||
Reference in New Issue
Block a user