summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-06-18 07:23:51 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-06-18 07:23:51 +0000
commitaa651725a8c0a4088842374179e92dbc641d57e0 (patch)
tree38aa645823aa41cdeb1eddbd07b66c0cfef109ff
parentce27c0c3344948a9706194d1a063fb2bea0d6ab3 (diff)
If a new hunk immediately follows the previous one, merge them
into a single hunk. This makes diff produce the same diff as gdiff in more cases. Found by brad@ and sturm@ using the ports tree. ok millert@
-rw-r--r--usr.bin/diff/diffreg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index e2e60305f44..6c5b36ce3ae 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.55 2004/01/07 17:18:32 otto Exp $ */
+/* $OpenBSD: diffreg.c,v 1.56 2004/06/18 07:23:50 otto Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -65,7 +65,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.55 2004/01/07 17:18:32 otto Exp $";
+static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.56 2004/06/18 07:23:50 otto Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -1008,8 +1008,8 @@ restart:
format == D_CONTEXT ? "---" : "+++", file2,
ctime(&stb2.st_mtime));
anychange = 1;
- } else if (a > context_vec_ptr->b + (2 * context) &&
- c > context_vec_ptr->d + (2 * context)) {
+ } else if (a > context_vec_ptr->b + (2 * context) + 1 &&
+ c > context_vec_ptr->d + (2 * context) + 1) {
/*
* If this change is more than 'context' lines from the
* previous change, dump the record and reset it.