From d8c62fa4ee9210ae7fa894150adad65340088865 Mon Sep 17 00:00:00 2001 From: ranomier Date: Sat, 14 Dec 2024 14:22:45 +0100 Subject: [PATCH] do nothing if git diff is empty --- nswitch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nswitch b/nswitch index 7f5e213..07c4ece 100755 --- a/nswitch +++ b/nswitch @@ -12,7 +12,8 @@ printf ">>> auto formating ..." nix fmt . &> /dev/null printf " DONE!\n" -git diff -U0 # "*.nix" +[ -z "$(git diff -U0)" ] && echo ">>> no changes, exiting ..." && exit 0 +git diff -U0 # "*.nix" # as a seperate command so we get nice colors and pager printf ">>> Do you want to rebuild NixOS? [y/N]\n" printf "<<< " && read -r YESNO