From 14a6e98dcb6c9d594ce594ce7fc214a8e44e21d3 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Tue, 24 Aug 2021 15:19:17 -0400 Subject: [PATCH] [O] Fix nix-git-update --- scripts/bashrc-nix.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/bashrc-nix.sh b/scripts/bashrc-nix.sh index 1cb3f35..cc4ebf5 100644 --- a/scripts/bashrc-nix.sh +++ b/scripts/bashrc-nix.sh @@ -4,19 +4,28 @@ alias rebuild-gc="rebuild; gc" # Update git nix-git-update() { + pushd /etc/nixos + # Make sure there aren't any other changes if git diff-index --quiet HEAD --; then # No changes - pushd /etc/nixos update-nix-fetchgit *.nix - rebuild-gc - git add *.nix - git commit -m "[U] Update fetchgit refs" - git push - popd + + # If there are changes after updating + if git diff-index --quiet HEAD --; then + rebuild-gc + git add *.nix + git commit -m "[U] Update fetchgit refs" + git push + echo "Successfully updated fetchgit refs" + else + echo "There aren't any updates" + fi else # Changes echo "Error: There are uncommitted changes" git status fi + + popd }