This results in 'failure' status if any wiggles were required.
Signed-off-by: NeilBrown <neilb@suse.de>
{"quiet", 0, 0, 'q'},
{"strip", 1, 0, 'p'},
{"no-ignore", 0, 0, 'i'},
- {"show-wiggle", 0, 0, 'W'},
+ {"show-wiggles",0, 0, 'W'},
{"ignore-blanks",0,0, 'b'},
{"self-test", 0, 0, SELF_TEST},
+ {"report-wiggles", 0, 0, REPORT_WIGGLES},
{0, 0, 0, 0}
};
changes are reported as conflicts rather than being ignored.
.TP
-.BR -W ", " \-\-show\-wiggle
+.BR -W ", " \-\-show\-wiggles
When used with
.IR \-\-merge ,
conflicts that can be wiggled into place are reported as conflicts
.fi
.in -5
+.TP
+.B \-\-report\-wiggles
+If a merge is successful in applying all changes, it will normally exit
+with a success status (0), only reporting failure (1) if a conflict
+occurred and was annotated. With
+.B \-\-report\-wiggles
+.I wiggle
+will also report failure if any changes had to be wiggled in. This
+can be useful when
+.I wiggle
+is used for automatic merges as with
+.IR git .
+If any wiggles happen,
+.I git
+will report the failure, and the results can be examined to confirm
+they are acceptable.
+
.TP
.BR -h ", " \-\-help
Print a simple help message. If given after one of the function
will exit with a status of 0 if all changes were successfully merged,
and with an exit status of 1 and a brief message if any changes could
not be fully merged and were instead inserted as annotations.
+However if either
+.B \-\-report\-wiggles
+or
+.B \-\-show\-wiggles
+options were given,
+.I wiggle
+will also exist with status of 1 if any changes had to be wiggled in
+even though this was successful.
The merge function can operate in three different modes with respect
to lines or words.
Without either of these options, a hybrid approach is taken.
Individual words are compared and merged, but when a conflict is found
-the whole surrounding line is reported as being in conflict.
+the whole surrounding line is reported as being in conflict.
.I wiggle
will ensure that every change between the two other texts is reflected
csl2 = diff_patch(fl[1], fl[2]);
ci = make_merger(fl[0], fl[1], fl[2], csl1, csl2,
- obj == 'w', ignore, show_wiggles);
+ obj == 'w', ignore, show_wiggles > 1);
print_merge(outfile, &fl[0], &fl[1], &fl[2],
obj == 'w', ci.merger);
if (!quiet && ci.conflicts)
return 2;
}
}
- return (ci.conflicts > 0);
+ if (show_wiggles)
+ return ci.conflicts + ci.wiggles > 0;
+ else
+ return ci.conflicts > 0;
}
static int multi_merge(int argc, char *argv[], int obj, int blanks,
ignore = 0;
continue;
case 'W':
- show_wiggles = 1;
+ show_wiggles = 2;
ignore = 0;
continue;
+ case REPORT_WIGGLES:
+ show_wiggles = 1;
+ continue;
case '1':
case '2':
extern struct option long_options[];
enum other_options {
SELF_TEST = 300,
+ REPORT_WIGGLES = 301,
};
extern char Usage[];
extern char Help[];