From 38e33a4c6c64780b3d7d3bc46463d3b6f4efffdd Mon Sep 17 00:00:00 2001 From: pagedMov Date: Fri, 11 Oct 2024 21:24:21 -0400 Subject: [PATCH] Gen 386: added new diff checking logic to nixcommit.sh --- glasshouse-desktop/home/scripts/scripts/nixcommit.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/glasshouse-desktop/home/scripts/scripts/nixcommit.sh b/glasshouse-desktop/home/scripts/scripts/nixcommit.sh index 23d5dfb..c6691c2 100755 --- a/glasshouse-desktop/home/scripts/scripts/nixcommit.sh +++ b/glasshouse-desktop/home/scripts/scripts/nixcommit.sh @@ -3,12 +3,22 @@ scheck && runbg aplay ~/media/sound/sys/nixswitch-start.wav builtin cd "$HOME/sysflakes" || exit nix flake update +if [ -n "$2" ]; then + echo "too many arguments" + exit +fi gen=$(readlink /nix/var/nix/profiles/system | sed 's/.*system-\([0-9]*\)-link/\1/') gen=$((gen + 1)) +diffcheck=$(git status | grep "working tree clean") +if [ -n "$diffcheck" ]; then + scheck && runbg aplay ~/media/sound/sys/warning.wav + echo "Nothing to commit" + exit +fi git add . -git commit -m "Gen $gen: $@" +git commit -m "Gen $gen: $1" git push scheck && runbg aplay ~/media/sound/sys/gitpush.wav builtin cd - || exit