From 32539a65a640356395f841e360e49e55df00a25b Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 6 Apr 2023 13:35:29 -0400 Subject: [PATCH] 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> --- scripts/update_birdnet.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh index 1410f5a..6795df3 100755 --- a/scripts/update_birdnet.sh +++ b/scripts/update_birdnet.sh @@ -41,6 +41,9 @@ sudo_with_user () { set +x } +# Get current HEAD hash +commit_hash=$(sudo_with_user 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/