fix git diff --stat

previously it would show changes between the current HEAD and the previous HEAD, which would neglect to show all the file changes from multiple commits, only the most recent one. this makes sure we store the HEAD hash from before the system is updated, and then compared to HEAD after it's updated.

Co-Authored-By: lloydbayley <21309308+lloydbayley@users.noreply.github.com>
This commit is contained in:
ehpersonal38
2023-04-06 13:35:29 -04:00
parent 825e3926fa
commit c05ce2685d
+4 -1
View File
@@ -41,6 +41,9 @@ sudo_with_user () {
set +x
}
# Get current HEAD hash
commit_hash=$(git -C $HOME/BirdNET-Pi rev-parse HEAD)
# Reset current HEAD to remove any local changes
sudo_with_user git -C $HOME/BirdNET-Pi reset --hard
@@ -51,7 +54,7 @@ sudo_with_user git -C $HOME/BirdNET-Pi fetch $remote $branch
sudo_with_user git -C $HOME/BirdNET-Pi switch -C $branch --track $remote/$branch
# Prints out changes
sudo_with_user git -C $HOME/BirdNET-Pi diff --stat HEAD^ HEAD
sudo_with_user git -C $HOME/BirdNET-Pi diff --stat $commit_hash HEAD
sudo systemctl daemon-reload
sudo ln -sf $my_dir/* /usr/local/bin/