[git commit master 1/1] patch: add -N and a test for it (fails for now)
Denys Vlasenko
vda.linux at googlemail.com
Sun Aug 15 23:33:57 UTC 2010
commit: http://git.busybox.net/busybox/commit/?id=a4160e15ec866005f3ad30c967bc4829fbb1c8e3
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
editors/patch.c | 6 ++++--
testsuite/patch.tests | 27 ++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/editors/patch.c b/editors/patch.c
index 693af5b..eb16bca 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -245,14 +245,16 @@ struct globals {
//bbox had: "p:i:RN"
-#define FLAG_STR "Rup:i:x"
+#define FLAG_STR "Rup:i:Nx"
/* FLAG_REVERSE must be == 1! Code uses this fact. */
#define FLAG_REVERSE (1 << 0)
#define FLAG_u (1 << 1)
#define FLAG_PATHLEN (1 << 2)
#define FLAG_INPUT (1 << 3)
+// -N: not supported yet
+#define FLAG_IGNORE (1 << 4)
//non-standard:
-#define FLAG_DEBUG (1 << 4)
+#define FLAG_DEBUG (1 << 5)
// Dispose of a line of input, either by writing it out or discarding it.
diff --git a/testsuite/patch.tests b/testsuite/patch.tests
index 6ee795d..e663b32 100755
--- a/testsuite/patch.tests
+++ b/testsuite/patch.tests
@@ -4,7 +4,7 @@
. ./testing.sh
-# testing "test name" "options" "expected result" "file input" "stdin"
+# testing "test name" "command(s)" "expected result" "file input" "stdin"
testing "patch with old_file == new_file" \
'patch 2>&1; echo $?; cat input' \
@@ -126,6 +126,31 @@ abc
+456
" \
+# testing "test name" "command(s)" "expected result" "file input" "stdin"
+
+testing "patch -N ignores already applied hunk" \
+ 'patch -N 2>&1; echo $?; cat input' \
+"\
+patching file input
+0
+abc
+def
+123
+" \
+"\
+abc
+def
+123
+" \
+"\
+--- input
++++ input
+@@ -1,2 +1,3 @@
+ abc
++def
+ 123
+" \
+
rm input.orig 2>/dev/null
exit $FAILCOUNT
--
1.7.1
More information about the busybox-cvs
mailing list