Blame SOURCES/patch-2.7.6-make-debug-output-more-useful.patch

0a6a4f
commit ff81775f4eb6ab9a91b75e4031e8216654c0c76a
0a6a4f
Author: Andreas Gruenbacher <agruen@gnu.org>
0a6a4f
Date:   Fri Aug 17 10:31:22 2018 +0200
0a6a4f
0a6a4f
    Make the (debug & 2) output more useful
0a6a4f
    
0a6a4f
    * src/pch.c (another_hunk): In the (debug & 2) output, fix how empty
0a6a4f
    lines that are not part of the patch context are printed.  Also, add
0a6a4f
    newlines to lines that are missing them to keep the output readable.
0a6a4f
0a6a4f
diff --git a/src/pch.c b/src/pch.c
0a6a4f
index 1bb3153..e92bc64 100644
0a6a4f
--- a/src/pch.c
0a6a4f
+++ b/src/pch.c
0a6a4f
@@ -1916,8 +1916,13 @@ another_hunk (enum diff difftype, bool rev)
0a6a4f
 	lin i;
0a6a4f
 
0a6a4f
 	for (i = 0; i <= p_end + 1; i++) {
0a6a4f
-	    fprintf (stderr, "%s %c",
0a6a4f
-		     format_linenum (numbuf0, i),
0a6a4f
+	    fputs (format_linenum (numbuf0, i), stderr);
0a6a4f
+	    if (p_Char[i] == '\n')
0a6a4f
+	      {
0a6a4f
+	        fputc('\n', stderr);
0a6a4f
+		continue;
0a6a4f
+	      }
0a6a4f
+	    fprintf (stderr, " %c",
0a6a4f
 		     p_Char[i]);
0a6a4f
 	    if (p_Char[i] == '*')
0a6a4f
 	      fprintf (stderr, " %s,%s\n",
0a6a4f
@@ -1930,7 +1935,8 @@ another_hunk (enum diff difftype, bool rev)
0a6a4f
 	    else if (p_Char[i] != '^')
0a6a4f
 	      {
0a6a4f
 		fputs(" |", stderr);
0a6a4f
-		pch_write_line (i, stderr);
0a6a4f
+		if (! pch_write_line (i, stderr))
0a6a4f
+		  fputc('\n', stderr);
0a6a4f
 	      }
0a6a4f
 	    else
0a6a4f
 	      fputc('\n', stderr);