From 84d3dc3366369ba0f4c3530171a9e0aa7ed04a05 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:13:01 +0000 Subject: [PATCH] improve updatecheck (#108) * improve grep * fix get_local_branch --- advanced/Scripts/updatecheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 5716f4b5ba..3eec092b96 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -11,7 +11,8 @@ function get_local_branch() { # Return active branch cd "${1}" 2> /dev/null || return 1 - git rev-parse --abbrev-ref HEAD || return 1 + local foundBranch=$(git show-ref --heads | grep "$(git rev-parse HEAD)" | awk '{print $2;}' | cut -d '/' -f 3) + echo "${foundBranch:-HEAD}" } function get_local_version() { @@ -36,7 +37,6 @@ function get_remote_version() { fi } - function get_remote_hash(){ git ls-remote "https://github.com/arevindh/${1}" --tags "${2}" | awk '{print substr($0, 0,8);}' || { git ls-remote "https://github.com/pi-hole/${1}" --tags "${2}" | awk '{print substr($0, 0,8);}' || return 1; } }