We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 692fa3d + cf15036 commit 7fdd44fCopy full SHA for 7fdd44f
1 file changed
scripts/installUpgradeFunctions.sh
@@ -123,7 +123,18 @@ function get_version()
123
function get_branch()
124
{
125
local H="${1:-${ALLSKY_HOME}}"
126
- echo "$( cd "${H}" || exit; git rev-parse --abbrev-ref HEAD )"
+ local BRANCH="$( cd "${H}" || exit; git rev-parse --abbrev-ref HEAD )"
127
+ if [[ ${BRANCH} == "HEAD" ]]; then
128
+ # If the user is getting the master branch but uses the "--branch master_branch_name",
129
+ # BRANCH will be "HEAD". For example if the master branch is v2024.12.06_02 and the user
130
+ # runs "git clone --branch v2024.12.06_02 ...".
131
+ local FILE="${H}/.git/packed-refs"
132
+ if [[ -s ${FILE} ]]; then
133
+ local B="$( tail -1 "${FILE}" | sed -e 's;.*/;;' )"
134
+ [[ -n ${B} ]] && BRANCH="${B}"
135
+ fi
136
137
+ echo "${BRANCH}"
138
}
139
140
0 commit comments