[PATCH] dim: Sort sparse output after remapping

Arkadiusz Hiler arkadiusz.hiler at intel.com
Fri Jul 5 12:05:15 UTC 2019


If patch happens to move lines around it's easy to end in a situation
where we end up with errors just moving around:

-error1:123
 error2:124
+error1:125

With remapping, sorting and then diffing without context we end up with:
-error1:123
+error1:123

Which is quite confusing and should not generate warning in the first
place.

This can be fixed by sorting the lines *after* the remapping.

Cc: Daniel Vetter <daniel at ffwll.ch>
Reported-by: Oleg Vasilev <oleg.vasilev at intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 dim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index bada79c..1cfe090 100755
--- a/dim
+++ b/dim
@@ -1792,13 +1792,13 @@ function dim_sparse
 
 	for commit in "${commits[@]}"; do
 		touch --no-create $(git diff --name-only $commit~...$commit)
-		prev_sr="$(make C=1 -j$(nproc) drivers/gpu/drm/ 2>&1 1>/dev/null | sort)"
+		prev_sr="$(make C=1 -j$(nproc) drivers/gpu/drm/ 2>&1 1>/dev/null)"
 
 		git checkout --detach $commit >/dev/null 2>&1
-		sr="$(make C=1 -j$(nproc) drivers/gpu/drm/ 2>&1 1>/dev/null | sort)"
+		sr="$(make C=1 -j$(nproc) drivers/gpu/drm/ 2>&1 1>/dev/null)"
 
 		prev_remapped="$(echo "$prev_sr" | $remap_log <(git diff HEAD~ | $remap_log))"
-		diff_result="$(diff -u <(echo "$prev_remapped") <(echo "$sr") || true)"
+		diff_result="$(diff -u <(echo "$prev_remapped" | sort) <(echo "$sr" | sort) || true)"
 
 		echo "Commit: $(git log -n1 --format='%s' $commit)"
 		if [ -n "$diff_result" ]; then
-- 
2.21.0



More information about the dim-tools mailing list