Skip to content

Commit

Permalink
Ensure remote branches are known
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Nov 4, 2023
1 parent 7fe68e9 commit 3d461a1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions addon_meterstoha/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,26 @@ GIT_VERSION_STR=
if bashio::config.has_value "git_version" ; then
GIT_VERSION="$(bashio::config git_version)"
# shellcheck disable=SC2089
GIT_VERSION_STR="\"${GIT_VERSION/\"/\\\"}\""
GIT_VERSION_STR="${GIT_VERSION/\"/\\\"}"
fi

git clone --depth=1 "https://github.com/mdeweerd/MetersToHA.git" --no-checkout MetersToHA
(
cd MetersToHA || exit 255
git sparse-checkout set apps

if [ "$GIT_VERSION_STR" != "" ] ; then
# Make sure we have copy of branches
git remote set-branches origin '*'
git fetch -v --depth=1
fi

# GIT_VERSION_STR is allowed to be empty
echo "git checkout $GIT_VERSION_STR"
# shellcheck disable=SC2086,SC2090
git checkout $GIT_VERSION_STR

echo "MetersToHA Container version: $(bashio::addon.version).008 @$(stat -c '%y' "${MYDIR}run.sh")"
echo "MetersToHA Container version: $(bashio::addon.version).010 @$(stat -c '%y' "${MYDIR}run.sh")"
git show -s --pretty=format:"MetersToHA Python GIT version: %h on %ad%n"
)

Expand Down

0 comments on commit 3d461a1

Please sign in to comment.