From f8972f58e80f6a373cb71f90113e71f34100def9 Mon Sep 17 00:00:00 2001 From: Nate Williams Date: Mon, 20 Feb 1995 18:47:18 +0000 Subject: [PATCH] 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 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 --- gnu/usr.bin/diff/diff3.c | 23 +++++++++++++++-------- gnu/usr.bin/diff3/diff3.1 | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gnu/usr.bin/diff/diff3.c b/gnu/usr.bin/diff/diff3.c index 1ac3887cd42..1085c9b08a8 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"; diff --git a/gnu/usr.bin/diff3/diff3.1 b/gnu/usr.bin/diff3/diff3.1 index b1903289be0..9873b0887d8 100644 --- a/gnu/usr.bin/diff3/diff3.1 +++ b/gnu/usr.bin/diff3/diff3.1 @@ -39,6 +39,9 @@ into .IR mine , surrounding all conflicts with bracket lines. .TP +.B \-B +Old behavior of -A. Shows non-conflicts. +.TP .B \-e Generate an .I ed