plan9fox/sys/src/cmd/diff
Ori Bernstein 5d37407e3c diff: avoid empty hunks when there are no changes
Currently, diff outputs a file header, even if there are
no changes to the file. This is wonky.

It means that the header chunks are ambiguous, since
not all header chunks are followed by '@@ hunk', and
'--- file', '+++ file' lines can be generated from
file content.

This changes the way that we decide to print the file
header, so we only print it when outputting the first
hunk on flushchanges.

Flushchanges is called once per regular file, at the
end of `diffreg`, so we output a hunk header once per
file.
2022-06-04 02:21:19 +00:00
..
diff.h diff: avoid empty hunks when there are no changes 2022-06-04 02:21:19 +00:00
diffdir.c diff: fix style 2022-05-22 16:34:33 +00:00
diffio.c diff: avoid empty hunks when there are no changes 2022-06-04 02:21:19 +00:00
diffreg.c diff: avoid empty hunks when there are no changes 2022-06-04 02:21:19 +00:00
main.c diff: retain original file names 2022-05-22 16:41:47 +00:00
mkfile Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00