summaryrefslogtreecommitdiffstats
path: root/patches/0016-Make-the-debug-2-output-more-useful.patch
blob: c44d8fee8b8b31c6f09b3f04e02ee1a3e6d566bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From ff81775f4eb6ab9a91b75e4031e8216654c0c76a Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruen@gnu.org>
Date: Fri, 17 Aug 2018 10:31:22 +0200
Subject: [PATCH 16/17] Make the (debug & 2) output more useful

* src/pch.c (another_hunk): In the (debug & 2) output, fix how empty
lines that are not part of the patch context are printed.  Also, add
newlines to lines that are missing them to keep the output readable.
---
 src/pch.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/pch.c b/src/pch.c
index 1bb3153..e92bc64 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -1916,8 +1916,13 @@ another_hunk (enum diff difftype, bool rev)
 	lin i;
 
 	for (i = 0; i <= p_end + 1; i++) {
-	    fprintf (stderr, "%s %c",
-		     format_linenum (numbuf0, i),
+	    fputs (format_linenum (numbuf0, i), stderr);
+	    if (p_Char[i] == '\n')
+	      {
+	        fputc('\n', stderr);
+		continue;
+	      }
+	    fprintf (stderr, " %c",
 		     p_Char[i]);
 	    if (p_Char[i] == '*')
 	      fprintf (stderr, " %s,%s\n",
@@ -1930,7 +1935,8 @@ another_hunk (enum diff difftype, bool rev)
 	    else if (p_Char[i] != '^')
 	      {
 		fputs(" |", stderr);
-		pch_write_line (i, stderr);
+		if (! pch_write_line (i, stderr))
+		  fputc('\n', stderr);
 	      }
 	    else
 	      fputc('\n', stderr);
-- 
2.11.0