Commit Graph

14 Commits

Author SHA1 Message Date
Kyle Evans
e68edb8cf0 diff(1): Implement -B/--ignore-blank-lines
As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for GNU diff to /usr/local/bin/diff

Implement the -B flag and add some primitive tests for it. It is implemented
in the same fashion that -I is implemented; each chunk's lines are scanned,
and if a non-blank line is encountered then the chunk will be output.
Otherwise, it's skipped.

MFC after:	2 weeks
2018-08-19 03:57:20 +00:00
Xin LI
9977c7b512 Improve --strip-trailing-cr handling:
- Advance ctold for f1 and ctnew for f2
 - ungetc() if the character is unexpected
 - Don't break early when we hit the combination on one side

PR:		230049
Reported by:	maskray <emacsray gmail com>
Reviewed by:	bapt, maskray
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16451
2018-07-27 05:21:20 +00:00
Bryan Drewery
3806950135 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:04:07 +00:00
Enji Cooper
274b460b60 Use more flexible expression for replacing t_diff in
contrib/netbsd-tests/usr.bin/diff/t_diff.sh with the name of the script via
`basename $0`.

This was a change I forgot to port over from
^/head/gnu/usr.bin/diff/tests/Makefile@r272787.
2017-07-19 18:30:16 +00:00
Enji Cooper
4017abe27c Add tests that exercise -q, like -rq and add tests that test -q like -Nrq
MFC after:	2 months
MFC with:	r321076, r321077, r321078
2017-07-17 18:07:53 +00:00
Enji Cooper
4574a545d2 Add some tests for brief (--brief/-q) format
MFC after:	2 months
MFC with:	r321076
2017-07-17 17:50:50 +00:00
Enji Cooper
29d65f1cb4 Add some testcases for diff --side-by-side support
These are were created proactively, in anticipation of the support being
fully implemented sometime in the future.

The tests currently fail on ^/head@r319845, however. Expect them to fail.

PR:		219933
Tested with:	gdiff
2017-06-12 05:11:43 +00:00
Baptiste Daroussin
fddcb7b82f Implement a basic --changed-group-format
etcupdate(8) requires that option, while GNU diff supports many more variation
of that options, their behaviour beside the simple verion implemented here are
quite inconsistent as such I do not plan to implement those.

The only special keyword supported by this implementation are: %< and %>
%= is not implemented as the documentation of GNU diff says: common lines, but
it actually when tested print the changes from the first file
2017-04-20 14:22:33 +00:00
Baptiste Daroussin
05d06ecac3 Add a regression test for diff -D 2017-04-20 11:32:18 +00:00
Jilles Tjoelker
385a67dc6a diff: Show nanoseconds in -u/-c header line.
Show nanoseconds in the -u/-c header line.

The present portability conditionals cannot handle the POSIX standard
st_mtim, so remove them and unconditionally use st_mtim.

PR:		218018
Reported by:	jbeich
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D10145
2017-03-26 19:47:43 +00:00
Jilles Tjoelker
58cf4d864f diff: Fix mtime of file1 in -u/-c header line.
PR:		218018
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D10140
2017-03-26 14:09:25 +00:00
Enji Cooper
458cbf0ae6 Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme

usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-23 03:28:24 +00:00
Enji Cooper
beeed5993e Integrate contrib/netbsd-tests/usr.bin/diff/t_diff.sh in as
.../usr.bin/diff/diff_test

Some minor adjustment needed to be done for :same as it currently
has the test script hardcoded into the test, instead of using an
idiom like $(dirname $0)

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-15 06:18:14 +00:00
Baptiste Daroussin
3bbe3f672e Import diff from OpenBSD and remove GNU diff
Some of the modifications from the previous summer of code has been integrated
Modification for compatibility with GNU diff output has been added

Main difference with OpenBSD:
Implement multiple GNU diff options:
* --ignore-file-name-case
* --no-ignore-file-name-case
* --normal
* --tabsize
* --strip-trailing-cr
Make diff -p compatible with GNU diff
Implement diff -l
Make diff -r compatible with GNU diff

Capsicumize diffing 2 regular files
Add a simple test suite

Approved by:	AsiaBSDcon devsummit
Obtained from:	OpenBSD, GSoC
Relnotes:	yes
2017-03-11 05:01:29 +00:00