[git commit] patch: make it able to create files (again)

Denys Vlasenko vda.linux at googlemail.com
Mon Aug 22 02:58:32 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=c5f7847659ccddd27c99b300e01f36516326aa3a
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

I broke patch's ability to create files in November, and nobody noticed in
the ensuing 11 months.  Sigh.

Signed-off-by: Rob Landley <rob at landley.net>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/patch.c       |    8 +++-----
 testsuite/patch.tests |    1 -
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/editors/patch.c b/editors/patch.c
index ec5b8e7..1f2a49b 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -70,8 +70,7 @@ struct double_list {
 
 // Free all the elements of a linked list
 // Call freeit() on each element before freeing it.
-static
-void dlist_free(struct double_list *list, void (*freeit)(void *data))
+static void dlist_free(struct double_list *list, void (*freeit)(void *data))
 {
 	while (list) {
 		void *pop = list;
@@ -83,8 +82,7 @@ void dlist_free(struct double_list *list, void (*freeit)(void *data))
 }
 
 // Add an entry before "list" element in (circular) doubly linked list
-static
-struct double_list *dlist_add(struct double_list **list, char *data)
+static struct double_list *dlist_add(struct double_list **list, char *data)
 {
 	struct double_list *llist;
 	struct double_list *line = xmalloc(sizeof(*line));
@@ -232,7 +230,7 @@ static int apply_one_hunk(void)
 		else matcheof = 0;
 		if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data);
 	}
-	matcheof = matcheof < TT.context;
+	matcheof = !matcheof || matcheof < TT.context;
 
 	if (PATCH_DEBUG) fdprintf(2,"MATCHEOF=%c\n", matcheof ? 'Y' : 'N');
 
diff --git a/testsuite/patch.tests b/testsuite/patch.tests
index 7cd716c..8caeed5 100755
--- a/testsuite/patch.tests
+++ b/testsuite/patch.tests
@@ -212,7 +212,6 @@ patching file input
  666
 " \
 
-# Currently fails
 # testing "test name" "command(s)" "expected result" "file input" "stdin"
 testing "patch creates new file" \
 	'patch 2>&1; echo $?; cat testfile; rm testfile' \
-- 
1.7.3.4



More information about the busybox-cvs mailing list