diff options
-rw-r--r-- | editors/patch.c | 6 | ||||
-rwxr-xr-x | testsuite/patch.tests | 27 |
2 files changed, 30 insertions, 3 deletions
diff --git a/editors/patch.c b/editors/patch.c index 693af5b7d..eb16bca12 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -245,14 +245,16 @@ struct globals { | |||
245 | 245 | ||
246 | 246 | ||
247 | //bbox had: "p:i:RN" | 247 | //bbox had: "p:i:RN" |
248 | #define FLAG_STR "Rup:i:x" | 248 | #define FLAG_STR "Rup:i:Nx" |
249 | /* FLAG_REVERSE must be == 1! Code uses this fact. */ | 249 | /* FLAG_REVERSE must be == 1! Code uses this fact. */ |
250 | #define FLAG_REVERSE (1 << 0) | 250 | #define FLAG_REVERSE (1 << 0) |
251 | #define FLAG_u (1 << 1) | 251 | #define FLAG_u (1 << 1) |
252 | #define FLAG_PATHLEN (1 << 2) | 252 | #define FLAG_PATHLEN (1 << 2) |
253 | #define FLAG_INPUT (1 << 3) | 253 | #define FLAG_INPUT (1 << 3) |
254 | // -N: not supported yet | ||
255 | #define FLAG_IGNORE (1 << 4) | ||
254 | //non-standard: | 256 | //non-standard: |
255 | #define FLAG_DEBUG (1 << 4) | 257 | #define FLAG_DEBUG (1 << 5) |
256 | 258 | ||
257 | // Dispose of a line of input, either by writing it out or discarding it. | 259 | // Dispose of a line of input, either by writing it out or discarding it. |
258 | 260 | ||
diff --git a/testsuite/patch.tests b/testsuite/patch.tests index 6ee795dba..e663b32a3 100755 --- a/testsuite/patch.tests +++ b/testsuite/patch.tests | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | . ./testing.sh | 5 | . ./testing.sh |
6 | 6 | ||
7 | # testing "test name" "options" "expected result" "file input" "stdin" | 7 | # testing "test name" "command(s)" "expected result" "file input" "stdin" |
8 | 8 | ||
9 | testing "patch with old_file == new_file" \ | 9 | testing "patch with old_file == new_file" \ |
10 | 'patch 2>&1; echo $?; cat input' \ | 10 | 'patch 2>&1; echo $?; cat input' \ |
@@ -126,6 +126,31 @@ abc | |||
126 | +456 | 126 | +456 |
127 | " \ | 127 | " \ |
128 | 128 | ||
129 | # testing "test name" "command(s)" "expected result" "file input" "stdin" | ||
130 | |||
131 | testing "patch -N ignores already applied hunk" \ | ||
132 | 'patch -N 2>&1; echo $?; cat input' \ | ||
133 | "\ | ||
134 | patching file input | ||
135 | 0 | ||
136 | abc | ||
137 | def | ||
138 | 123 | ||
139 | " \ | ||
140 | "\ | ||
141 | abc | ||
142 | def | ||
143 | 123 | ||
144 | " \ | ||
145 | "\ | ||
146 | --- input | ||
147 | +++ input | ||
148 | @@ -1,2 +1,3 @@ | ||
149 | abc | ||
150 | +def | ||
151 | 123 | ||
152 | " \ | ||
153 | |||
129 | rm input.orig 2>/dev/null | 154 | rm input.orig 2>/dev/null |
130 | 155 | ||
131 | exit $FAILCOUNT | 156 | exit $FAILCOUNT |