=====================
*match-xsa*
-* The reporting can probably be improved: aka, highlight blocks with potential issues better. For example, embed relevant portions of an XSA into the output in cases where there is no match
-* Issue with *--smart*: currently falls over and produces a non-match if the per-file diffs from *git show* and in the *.patch* file are listed in a different order. This seems to happen rarely, but does happen.
+* The reporting can probably be improved: aka, highlight blocks with potential issues better. For example, embed relevant portions of an XSA into the output in cases where there is no match
* --xsadir currently only works when providing an absolute path (the issue was introduced in commit 6d371d6adccc36eeeb5d2acd412ba0f3424a4a15)
*xsa.git:Infra/xsa-list-patches*
next;
} elsif (index($lines[$i], "-") == 0) {
# Only allow "-*", but not "--", "---", etc.
+ # We can throw away "--" and "---" as in git we only
+ # compare different versions of the same file
if (index($lines[$i], "--") != 0) {
push @newlines, $lines[$i];
next;
push @newlines, "@@";
next;
}
- }
-
- return join "\n", @newlines;
-}
\ No newline at end of file
+ }
+
+ # At this point, we have diff chunks neatly identified
+ # by "+++". All we have to do is re-join the lines, split them
+ # into chunks (1 per pseudo-line), sort them, re-assemble.
+ $text = join "\n", @newlines;
+ # Make sure this ends with a newline (otherwise the next
+ # section
+ $text .= "\n";
+
+ my @plines = split /^\+\+\+ /m, $text;
+ my @newplines = sort @plines;
+
+ return join "+++ ", @newplines;
+}