Skip to content

Commit

Permalink
Fix history traversal of merge commits (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukiffer committed May 15, 2023
1 parent d698951 commit 1e1bebb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/utilities/verify-files-changed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand Down

0 comments on commit 1e1bebb

Please sign in to comment.