aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/diff
diff options
context:
space:
mode:
authorNate Williams <nate@FreeBSD.org>1995-02-20 18:47:18 +0000
committerNate Williams <nate@FreeBSD.org>1995-02-20 18:47:18 +0000
commitf8972f58e80f6a373cb71f90113e71f34100def9 (patch)
tree51360a61ea63ec3ea1690350c779bb28ec6197af /gnu/usr.bin/diff
parent56b688ea1c96f6ee19e1475aa6c1340c73240f31 (diff)
downloadsrc-f8972f58e80f6a373cb71f90113e71f34100def9.tar.gz
src-f8972f58e80f6a373cb71f90113e71f34100def9.zip
Fixed non-conflict errors that occur when changes made to the local files are
the same as the changes made in the repository. This is often seen by people with remote CVS trees that have applied their local patches to the master site. a 'cvs update' will show bogus conflicts. Obtained from: CVS mailing list, Stig<stig@inse.com> In diffutils 2.6 and 2.7, diff3 -A complains about identical overlapping changes. They're different from the ancestor but not from each other... Why bother? The patch below fixes this nonsense and preserves [B]ackwards compatiblity with the -B flag (also --show-bogus-conflicts). Party on... Stig
Notes
Notes: svn path=/head/; revision=6575
Diffstat (limited to 'gnu/usr.bin/diff')
-rw-r--r--gnu/usr.bin/diff/diff3.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gnu/usr.bin/diff/diff3.c b/gnu/usr.bin/diff/diff3.c
index 1ac3887cd42e..1085c9b08a88 100644
--- a/gnu/usr.bin/diff/diff3.c
+++ b/gnu/usr.bin/diff/diff3.c
@@ -163,7 +163,9 @@ static int simple_only;
/* If nonzero, do not output information for non-overlapping diffs. */
static int overlap_only;
-/* If nonzero, show information for DIFF_2ND diffs. */
+/* If nonzero, show information for 3_way and DIFF_2ND diffs.
+ 1= show 2nd only when 1st and 3rd differ
+ 2= show 2nd when DIFF_2ND (1 and 3 have same change relative to 2) */
static int show_2nd;
/* If nonzero, include `:wq' at the end of the script
@@ -204,6 +206,7 @@ static struct option const longopts[] =
{
{"text", 0, 0, 'a'},
{"show-all", 0, 0, 'A'},
+ {"show-bogus-conflicts", 0, 0, 'B'},
{"ed", 0, 0, 'e'},
{"show-overlap", 0, 0, 'E'},
{"label", 1, 0, 'L'},
@@ -242,15 +245,18 @@ main (argc, argv)
argv0 = argv[0];
- while ((c = getopt_long (argc, argv, "aeimvx3AEL:TX", longopts, 0)) != EOF)
+ while ((c = getopt_long (argc, argv, "aeimvx3ABEL:TX", longopts, 0)) != EOF)
{
switch (c)
{
case 'a':
always_text = 1;
break;
+ case 'B':
+ ++show_2nd;
+ /* Falls through */
case 'A':
- show_2nd = 1;
+ ++show_2nd;
flagging = 1;
incompat++;
break;
@@ -401,11 +407,12 @@ usage (status)
printf ("\
Usage: %s [options] my-file older-file your-file\n\
Options:\n\
- [-exAEX3aTv] [-i|-m] [-L label1 [-L label2 [-L label3]]]\n\
+ [-exABEX3aTv] [-i|-m] [-L label1 [-L label2 [-L label3]]]\n\
[--easy-only] [--ed] [--help] [--initial-tab]\n\
[--label=label1 [--label=label2 [--label=label3]]] [--merge]\n\
- [--overlap-only] [--show-all] [--show-overlap] [--text] [--version]\n\
- Only one of [exAEX3] is allowed\n", argv0);
+ [--overlap-only] [--show-all] [ --show-bogus-conflicts ]\n\
+ [--show-overlap] [--text] [--version]\n\
+ Only one of [exABEX3] is allowed\n", argv0);
exit (status);
}
@@ -1423,7 +1430,7 @@ output_diff3_edscript (outputfile, diff, mapping, rev_mapping,
switch (type)
{
default: continue;
- case DIFF_2ND: if (!show_2nd) continue; conflict = 1; break;
+ case DIFF_2ND: if (show_2nd < 2) continue; conflict = 1; break;
case DIFF_3RD: if (overlap_only) continue; conflict = 0; break;
case DIFF_ALL: if (simple_only) continue; conflict = flagging; break;
}
@@ -1552,7 +1559,7 @@ output_diff3_merge (infile, outputfile, diff, mapping, rev_mapping,
switch (type)
{
default: continue;
- case DIFF_2ND: if (!show_2nd) continue; conflict = 1; break;
+ case DIFF_2ND: if (show_2nd < 2) continue; conflict = 1; break;
case DIFF_3RD: if (overlap_only) continue; conflict = 0; break;
case DIFF_ALL: if (simple_only) continue; conflict = flagging;
format_2nd = "||||||| %s\n";