aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2011-11-22 06:08:26 -0600
committerRob Landley <rob@landley.net>2011-11-22 06:08:26 -0600
commit2471c066ea48555a9a92b7ce16bd2b3408a6ab18 (patch)
tree6992dd9dfee56197629ae1f39ef9f878a52924bb
parent624856d516c7a77bdf3bf853ccc2997a6f78df27 (diff)
downloadtoybox-2471c066ea48555a9a92b7ce16bd2b3408a6ab18.tar.gz
Don't complain about "possibly reversed" hunks that merely moved later in the file, just give a potential reason if it failed to apply.
-rw-r--r--toys/patch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/patch.c b/toys/patch.c
index dab3fbfb..974885ce 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -148,11 +148,7 @@ static int apply_one_hunk(void)
// of the hunk we'd be adding.)
while (plist && *plist->data == "+-"[reverse]) {
if (data && !strcmp(data, plist->data+1)) {
- if (!backwarn) {
- fdprintf(2,"Possibly reversed hunk %d at %ld\n",
- TT.hunknum, TT.linenum);
- backwarn++;
- }
+ if (!backwarn) backwarn = TT.linenum;
}
plist = plist->next;
}
@@ -164,6 +160,10 @@ static int apply_one_hunk(void)
// Does this hunk need to match EOF?
if (!plist && matcheof) break;
+ if (backwarn)
+ fdprintf(2,"Possibly reversed hunk %d at %ld\n",
+ TT.hunknum, TT.linenum);
+
// File ended before we found a place for this hunk.
fail_hunk();
goto done;