feat: [BT-11220]: Detect git diff file (#3617)

jobatzil/login/xforwardedfor
Marc Batchelor 2025-02-13 07:07:36 -05:00 committed by GitHub
parent 682f55de71
commit ca769a0a6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -52,6 +52,13 @@ if [ ! -f "$sourceDiffNames" ]; then
exit 4
fi
##### Detect git diff file, or processed filenames only
isDiffFile=$(grep -E "^diff --git a\/" "$uniqueFileNamesFile" | wc -l)
if [ $isDiffFile -gt 0 ]; then
echo "Received a diff file... fix it to be a filenames only file"
fileNamesOnlyVar=$(cat "$uniqueFileNamesFile"|grep -E "^diff --git" | sed 's/diff --git a\///' | sed 's/ b\/.*$//' | sort -u)
echo -e "$fileNamesOnlyVar">"$uniqueFileNamesFile"
fi
# Java files (and other files) which end up in jars - these are kept in .../src/main/x/x/x/*
cat "$uniqueFileNamesFile" | grep -E ".*.java$" | grep -v "/test/" > $sourceDiffNames