OpenBSD CVS

CVS log for src/usr.bin/diff/diffreg.c


[BACK] Up to [local] / src / usr.bin / diff

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: OPENBSD_6_2


Revision 1.91 / (download) - annotate - [select for diffs], Tue Mar 1 20:57:35 2016 UTC (8 years, 3 months ago) by natano
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.90: +4 -3 lines
Diff to previous 1.90 (colored)

Rectify line numbers for s/.// commands in ed-style diffs.

When diff encounters a line that consists of a single dot, it emits two
dots instead, stops the current command and emits a substitute command
to replace the double dot with a single one. Then it restarts the
(original) command if necessary and inserts further lines. This is done
because a single dot on a line does have special meaning in ed. (It
stops text insertion.)

Following issues are fixed by this commit.

- The line number for the substitute command should be the number of the
most recently inserted line. diff instead uses the number of the first
inserted line of the current hunk. The first character of that line is
removed when applying the diff, while the superfluous dot is not.

- The line number of the restarted command is not adjusted for the
number of lines already inserted, resulting in the reordering of lines..

- When there is a bare dot in the replacement text of a change command,
too many lines are deleted, because a second change command is emitted.
An append command should be emitted instead, because the target lines
have already been removed by the first change command.

tweaks and ok stefan@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.