- reject-print-function-01-drop-useless-test.patch: Drop useless
test in another_hunk(). - reject-print-function-02-handle-unified-format.patch: Preserve C function name in unified rejects (bnc#904519). OBS-URL: https://build.opensuse.org/package/show/devel:tools/patch?expand=0&rev=41
This commit is contained in:
parent
3a734d31a8
commit
88d552055b
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 10 11:37:03 CET 2014 - jdelvare@suse.de
|
||||||
|
|
||||||
|
- reject-print-function-01-drop-useless-test.patch: Drop useless
|
||||||
|
test in another_hunk().
|
||||||
|
- reject-print-function-02-handle-unified-format.patch: Preserve C
|
||||||
|
function name in unified rejects (bnc#904519).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 20 07:44:03 UTC 2014 - schwab@suse.de
|
Tue May 20 07:44:03 UTC 2014 - schwab@suse.de
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@ License: GPL-3.0+
|
|||||||
Group: Productivity/Text/Utilities
|
Group: Productivity/Text/Utilities
|
||||||
Source: http://ftp.gnu.org/gnu/patch/patch-%version.tar.bz2
|
Source: http://ftp.gnu.org/gnu/patch/patch-%version.tar.bz2
|
||||||
Patch: error-report-crash.patch
|
Patch: error-report-crash.patch
|
||||||
|
Patch1: reject-print-function-01-drop-useless-test.patch
|
||||||
|
Patch2: reject-print-function-02-handle-unified-format.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -45,6 +47,8 @@ Authors:
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch -p1
|
%patch -p1
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CFLAGS="$RPM_OPT_FLAGS -Wall -O2 -pipe"
|
export CFLAGS="$RPM_OPT_FLAGS -Wall -O2 -pipe"
|
||||||
|
22
reject-print-function-01-drop-useless-test.patch
Normal file
22
reject-print-function-01-drop-useless-test.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
From: Jean Delvare <jdelvare@suse.de>
|
||||||
|
Subject: Drop useless test in another_hunk()
|
||||||
|
Upstream: Submitted (2014-11-10)
|
||||||
|
|
||||||
|
This test will always succeed so it is either broken or useless. The
|
||||||
|
equivalent code path for context patches doesn't have this test so I
|
||||||
|
suppose it's OK to just remove it.
|
||||||
|
---
|
||||||
|
src/pch.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/src/pch.c
|
||||||
|
+++ b/src/pch.c
|
||||||
|
@@ -1651,7 +1651,7 @@ another_hunk (enum diff difftype, bool r
|
||||||
|
if (*s == ' ') s++;
|
||||||
|
if (*s++ != '@')
|
||||||
|
malformed ();
|
||||||
|
- if (*s++ == '@' && *s == ' ' && *s != '\0')
|
||||||
|
+ if (*s++ == '@' && *s == ' ')
|
||||||
|
{
|
||||||
|
p_c_function = s;
|
||||||
|
while (*s != '\n')
|
81
reject-print-function-02-handle-unified-format.patch
Normal file
81
reject-print-function-02-handle-unified-format.patch
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
From: Jean Delvare <jdelvare@suse.de>
|
||||||
|
Subject: Preserve C function name in unified rejects
|
||||||
|
Upstream: Submitted (2014-11-10)
|
||||||
|
References: bnc#904519
|
||||||
|
|
||||||
|
We already support that in context rejects, just do the same for
|
||||||
|
unified rejects.
|
||||||
|
---
|
||||||
|
src/patch.c | 3 ++-
|
||||||
|
tests/preserve-c-function-names | 16 ++++++++++++++++
|
||||||
|
tests/reject-format | 4 ++--
|
||||||
|
3 files changed, 20 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/preserve-c-function-names
|
||||||
|
+++ b/tests/preserve-c-function-names
|
||||||
|
@@ -34,6 +34,7 @@ EOF
|
||||||
|
preserve_trailing_blank=
|
||||||
|
|
||||||
|
diff -p -c -L a -L b a b > ab.diff
|
||||||
|
+diff -p -u -L a -L b a b > ab-unified.diff
|
||||||
|
touch c
|
||||||
|
check 'patch c < ab.diff || cat c.rej' <<EOF
|
||||||
|
patching file c
|
||||||
|
@@ -55,3 +56,18 @@ Hunk #1 FAILED at 2.
|
||||||
|
! return 2;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
+rm -f c.rej
|
||||||
|
+check 'patch c < ab-unified.diff || cat c.rej' <<EOF
|
||||||
|
+patching file c
|
||||||
|
+Hunk #1 FAILED at 2.
|
||||||
|
+1 out of 1 hunk FAILED -- saving rejects to file c.rej
|
||||||
|
+--- a
|
||||||
|
++++ b
|
||||||
|
+@@ -2,5 +2,5 @@ int foo()
|
||||||
|
+ {
|
||||||
|
+ /* waste a line */
|
||||||
|
+ $preserve_trailing_blank
|
||||||
|
+- return 1;
|
||||||
|
++ return 2;
|
||||||
|
+ }
|
||||||
|
+EOF
|
||||||
|
--- 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
|
Loading…
Reference in New Issue
Block a user