From 1e1bebbcbdae665e0cd99c5cf1472e558edfd236 Mon Sep 17 00:00:00 2001 From: Luke Fritz Date: Mon, 15 May 2023 09:03:01 -0500 Subject: [PATCH] Fix history traversal of merge commits (fix) --- scripts/utilities/verify-files-changed.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/utilities/verify-files-changed.sh b/scripts/utilities/verify-files-changed.sh index ecb5d56..0a83c62 100755 --- a/scripts/utilities/verify-files-changed.sh +++ b/scripts/utilities/verify-files-changed.sh @@ -5,17 +5,18 @@ function main() { local -r base_directory="$1" local -r grep_pattern="$2" local -r current_hash="$(git rev-parse HEAD)" - local -r previous_hash="$(git rev-list --tags --skip=1 --max-count=1)" - local -r previous_version="$(git describe --abbrev=0 --tags "$previous_hash")" + local -r previous_hash="$(git rev-list --tags --max-count=1)" + local -r previous_parent_hash="$(git rev-list --tags --no-merges --max-count=1)" + local -r previous_version="$(git describe --abbrev=0 --tags --exact-match "$previous_hash")" echo "Most recent tag was $previous_version at commit $previous_hash" echo "Complete changeset:" - git --no-pager diff --name-only "$previous_hash..$current_hash" + git --no-pager diff --name-only "$previous_parent_hash..$current_hash" echo "" echo "Looking for files in ./${base_directory}/ matching '${grep_pattern}'" - changeset="$(git --no-pager diff --name-only "$previous_hash..$current_hash")" + changeset="$(git --no-pager diff --name-only "$previous_parent_hash..$current_hash")" changeset="$(echo "$changeset" | grep -E "^$base_directory/.*")" changeset="$(echo "$changeset" | grep -E "$grep_pattern" || true)"