From bfd19bdfff113686019cbed0dd0537fefe7f4e33 Mon Sep 17 00:00:00 2001 From: K Jonathan Harker Date: Mon, 28 Apr 2014 16:08:32 -0700 Subject: [PATCH] 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 --- tools/run-compare-xml.sh | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tools/run-compare-xml.sh b/tools/run-compare-xml.sh index 4713d93041..2349a2aa99 100755 --- a/tools/run-compare-xml.sh +++ b/tools/run-compare-xml.sh @@ -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