File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ set -euo pipefail
2727exclude_pattern=" public_key|not-suspicious"
2828
2929# Array of filenames to exclude from checking (basename matching)
30- exclude_files=(" Import_test.cpp" )
30+ exclude_files=(
31+ " Import_test.cpp"
32+ " validators-example.txt"
33+ )
3134
3235# Get the repository's root directory
3336repo_root=$( git rev-parse --show-toplevel)
5356 git fetch --depth=1 origin " $base_ref "
5457 fi
5558
56- files_changed=$( git diff --name-only " origin/$base_ref " ...HEAD)
59+ # Since there's no merge base in shallow clones, we need to be creative
60+ # Save current HEAD, switch to base, then diff the trees
61+ current_head=$( git rev-parse HEAD)
62+ echo " Comparing against base branch origin/$base_ref ..."
63+
64+ # Get the tree objects to compare (this works even without shared history)
65+ base_tree=$( git rev-parse " origin/$base_ref ^{tree}" )
66+ head_tree=$( git rev-parse " $current_head ^{tree}" )
67+
68+ # Compare the two trees directly
69+ files_changed=$( git diff --name-only " $base_tree " " $head_tree " )
5770 mode=" PR changes"
5871 else
5972 # Regular push event: Check the actual commit that was pushed
You can’t perform that action at this time.
0 commit comments