diff --git a/local_build.sh b/local_build.sh index c37cf319..d70d6540 100755 --- a/local_build.sh +++ b/local_build.sh @@ -45,9 +45,12 @@ cd "$(dirname "$0")" # VERSION follows the fork's own numbering: the highest vX.Y.Z.W tag reachable # from HEAD (e.g. v1.17.1.10 from rak4631-full-companion-v1.17.1.10-preview3). # Local code changes add an identifier; build settings (untracked files) don't: -# -hz.N N local commits not in the maintainer's fork (upstream/keymindCascade; -# origin is the personal Gitea copy, so @{upstream} would hide them) -# .dirty uncommitted edits to tracked files +# -hz.N N of your own commits that change firmware code relative to the +# maintainer's fork (upstream/keymindCascade; origin is the personal +# Gitea copy, so @{upstream} would hide them) +# .dirty uncommitted edits to tracked firmware code +# Merge commits and the build-setup files below don't count: they change +# settings, not code. Edit LOCAL_FW_SETUP_PATHS if you add more setup files. # CORE is the upstream MeshCore version from examples/simple_repeater/MyMesh.h. LOCAL_FW_NAME=hazelwood @@ -60,11 +63,15 @@ if [ -z "$fork_version" ]; then fi local_id="" LOCAL_FW_UPSTREAM_REF=${LOCAL_FW_UPSTREAM_REF:-upstream/keymindCascade} -local_commits=$(git rev-list --count "${LOCAL_FW_UPSTREAM_REF}..HEAD" 2>/dev/null || echo 0) +LOCAL_FW_SETUP_PATHS=":(exclude)local_build.sh :(exclude)local_version.py :(exclude)platformio.local.ini" +# shellcheck disable=SC2086 # intentional word-splitting of the pathspec list +local_commits=$(git rev-list --count --no-merges "${LOCAL_FW_UPSTREAM_REF}..HEAD" \ + -- . $LOCAL_FW_SETUP_PATHS 2>/dev/null || echo 0) if [ "$local_commits" -gt 0 ]; then local_id="-hz.${local_commits}" fi -if [ -n "$(git status --porcelain --untracked-files=no)" ]; then +# shellcheck disable=SC2086 +if [ -n "$(git status --porcelain --untracked-files=no -- . $LOCAL_FW_SETUP_PATHS)" ]; then local_id="${local_id:--hz}.dirty" fi LOCAL_FW_VERSION="v${fork_version}${local_id}"