Skip to content

Commit

Permalink
scripts/Windows/build-mingw-prereqs.sh: minimize local filesystem cha…
Browse files Browse the repository at this point in the history
…nges when checking remote Git for changes [networkupstools#1491]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jan 20, 2025
1 parent b4f9e69 commit 64ecec7
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions scripts/Windows/build-mingw-prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,26 @@ provide_libmodbus_git() (
cd "${DLDIR}"
if [ -d "${DEP_DIRNAME}" ] ; then
{
# FIXME: Use `git ls-remote {URL|.}` to not modify the local FS if
# NOTE: Use `git ls-remote {URL|.}` to not modify the local FS if
# there's nothing to change (avoid re-packaging of CI artifact cache)
cd "${DEP_DIRNAME}" && \
git fetch --tags && \
git fetch --all && \
git checkout "${DEP_VERSION}" && \
_GITDIFF="`git diff "origin/${DEP_VERSION}"`" && \
if [ -n "${_GITDIFF}" ] ; then
FORCE=true
# Ensure rebase etc. or fail
git pull || exit
./autogen.sh || exit
LOCAL_HASH="`git log -1 --format='%H'`" && \
OTHER_HASH="`git ls-remote "${DEP_GITREPO}" | grep -E '(refs/(heads|tags)/'"${DEP_VERSION}"'$|^'"${DEP_VERSION}"')'`" && \
if [ x"${LOCAL_HASH}" = x"${OTHER_HASH}" ] ; then
echo "Current commit in '`pwd`' matches current '${DEP_VERSION}' in '${DEP_GITREPO}'" >&2
else
:
git fetch --tags && \
git fetch --all && \
git checkout "${DEP_VERSION}" && \
_GITDIFF="`git diff "origin/${DEP_VERSION}"`" && \
if [ -n "${_GITDIFF}" ] ; then
FORCE=true
# Ensure rebase etc. or fail
git pull || exit
./autogen.sh || exit
else
echo "Current content in '`pwd`' matches current '${DEP_VERSION}' in '${DEP_GITREPO}'" >&2
fi
fi
} || { chmod -R +w "${DEP_DIRNAME}" ; rm -rf "${DEP_DIRNAME}" ; }
fi
Expand Down

0 comments on commit 64ecec7

Please sign in to comment.