Page MenuHomeFreeBSD

diff3: allow diff3 ed scripts to generate deletions
ClosedPublic

Authored by thj on Apr 14 2022, 3:28 PM.

Details

Summary

diff3 with the -e (ed script flag) can generate line deletions, add support for
deletions and add a test case to exercise this behaviour. This functionality
was unearthed through comparison of bsd diff3 and gnu diff3 output.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 45182
Build 42070: arc lint + arc unit

Event Timeline

thj requested review of this revision.Apr 14 2022, 3:28 PM
usr.bin/diff3/diff3.c
142

I would use bool. It's a minor nit, but I think this code is unclear as it is.

527

The value of the boolean expression is used only once, so maybe it would be better to evaluate it directly in the function call?
Otherwise I would change the type of delete and move it to the if block - it doesn't seem to be used anywhere else.

usr.bin/diff3/diff3.c
527

I'll convert it to bool, I think having a variable helps make the code a little clearer here.

When -A and -m output modes come in they use the value of delete and I think consistency between the three output modes is a good idea.

  • Only end ed input stream if we aren't issuing a delete
This revision is now accepted and ready to land.Apr 15 2022, 1:55 PM
  • pass bool into prange in change
This revision now requires review to proceed.Apr 15 2022, 1:56 PM
This revision is now accepted and ready to land.Apr 15 2022, 1:57 PM