From 9189e24f6db351b908f93592aafd8e5e59346065 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Tue, 6 Oct 2015 13:48:38 +1100
Subject: [PATCH] dib-lint: ignore blank lines in element ordering

Some of the elements-deps in the project-config repo have a blank line
at the end, which throws out the ordering.  Strip blank lines, like
comment lines, before processing.

As an additional help, show a side-by-side diff of what is provided
versus what is expected when showing an error about sorting.

Change-Id: I007851ee01d6853ad992ce4437331e8bd79bbfce
---
 bin/dib-lint | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/dib-lint b/bin/dib-lint
index 03651a481..d9d5101a4 100755
--- a/bin/dib-lint
+++ b/bin/dib-lint
@@ -96,10 +96,11 @@ for i in $(find elements -type f \
     if [ $(basename $i) = "element-deps" ]; then
         UNSORTED=${TMPDIR}/element-deps.unsorted
         SORTED=${TMPDIR}/element-deps.sorted
-        grep -v '^#' $i > ${UNSORTED}
+        grep -v -e '^#' -e '^$' $i > ${UNSORTED}
         sort ${UNSORTED} > ${SORTED}
         if [ -n "$(diff -c ${UNSORTED} ${SORTED})" ]; then
             error "$i is not sorted alphabetically"
+            diff -y ${UNSORTED} ${SORTED}
         fi
     fi