Skip to content

Commit

Permalink
Fixed non-conflict errors that occur when changes made to the local f…
Browse files Browse the repository at this point in the history
…iles 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<[email protected]>

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
  • Loading branch information
YogoGit committed Feb 20, 1995
1 parent 56b688e commit f8972f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
23 changes: 15 additions & 8 deletions gnu/usr.bin/diff/diff3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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";
Expand Down
3 changes: 3 additions & 0 deletions gnu/usr.bin/diff3/diff3.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f8972f5

Please sign in to comment.