Check for new files as well as changed files

Currently, the run-compare-xml.sh script will only report changed or
removed files, it does not report new files being created. This change
replaces diff in a for loop with a recursive diff that treats missing
files as empty files. The result is that the output is presented as a
single unified diff that includes new files as well as changed and
removed files.

Change-Id: I0bb5a1ee93e689666ca5080ec5ccbe036c73d682
This commit is contained in:
K Jonathan Harker 2014-04-28 16:08:32 -07:00
parent 159bb69ce9
commit bfd19bdfff

View File

@ -57,26 +57,12 @@ cd .test/jenkins-job-builder
tox -e compare-xml-old
tox -e compare-xml-new
CHANGED=0
for x in `(cd .test/old/out && find -type f)`
do
if ! diff -u .test/old/out/$x .test/new/out/$x >/dev/null 2>&1
then
CHANGED=1
echo "============================================================"
echo $x
echo "------------------------------------------------------------"
fi
diff -u .test/old/out/$x .test/new/out/$x || /bin/true
done
cd ../..
diff -r -N -u .test/old/out .test/new/out
CHANGED=$? # 0 == same ; 1 == different ; 2 == error
echo
echo "You are in detached HEAD mode. If you are a developer"
echo "and not very familiar with git, you might want to do"
echo "'git checkout branch-name' to go back to your branch."
if [ "$CHANGED" -eq "1" ]; then
exit 1
fi
exit 0
exit $CHANGED