SHA256
1
0
forked from pool/patch
patch/reject-print-function-02-handle-unified-format.patch

52 lines
1.4 KiB
Diff

From: Steven Rostedt <rostedt@goodmis.org>
Subject: Preserve function names in reject files
Upstream: Committed (a2f4bfe0f3f54181a8f1077cde9ebef0b4f891c0)
References: bnc#904519
* src/patch.c (main): Preserve function names in reject files.
* tests/reject-format: Update the test case.
---
src/patch.c | 3 ++-
tests/reject-format | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
--- a/src/patch.c
+++ b/src/patch.c
@@ -1237,6 +1237,7 @@ abort_hunk_unified (bool header, bool re
lin old = 1;
lin lastline = pch_ptrn_lines ();
lin new = lastline + 1;
+ char const *c_function = pch_c_function();
if (header)
{
@@ -1251,7 +1252,7 @@ abort_hunk_unified (bool header, bool re
print_unidiff_range (rejfp, pch_first () + out_offset, lastline);
fprintf (rejfp, " +");
print_unidiff_range (rejfp, pch_newfirst () + out_offset, pch_repl_lines ());
- fprintf (rejfp, " @@\n");
+ fprintf (rejfp, " @@%s\n", c_function ? c_function : "");
while (pch_char (new) == '=' || pch_char (new) == '\n')
new++;
--- a/tests/reject-format
+++ b/tests/reject-format
@@ -79,7 +79,7 @@ check 'cat f.rej' <<EOF
Index: f
--- f.orig
+++ f
-@@ -2,6 +2,6 @@
+@@ -2,6 +2,6 @@ a() {
2
3
$preserve_trailing_blank
@@ -102,7 +102,7 @@ EOF
check 'cat f.rej' <<EOF
--- f.orig
+++ f
-@@ -2,6 +2,6 @@
+@@ -2,6 +2,6 @@ a() {
2
3
$preserve_trailing_blank