Page MenuHomePhabricator

Preserve the exit code of the diff command in binary_safe_diff.sh
ClosedPublic

Authored by dim on Dec 12 2015, 6:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 6:57 PM
Unknown Object (File)
Sun, Nov 17, 3:51 AM
Unknown Object (File)
Tue, Nov 5, 6:51 AM
Unknown Object (File)
Fri, Nov 1, 7:39 PM
Unknown Object (File)
Sat, Oct 26, 12:06 AM
Unknown Object (File)
Oct 19 2024, 10:31 PM
Unknown Object (File)
Oct 17 2024, 4:28 PM
Unknown Object (File)
Oct 16 2024, 7:25 PM

Details

Summary

Some versions of Subversion (1.9 in any case, maybe others) will
duplicate diff headers, if the diff command run through --diff-cmd
returns 0.

This lead to T9970, where the addition of a new file with properties
only shows the properties themselves in the review, not the content of
the new file.

Test Plan

This is a trivial change, is a test needed at all?

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim retitled this revision from to Preserve the exit code of the diff command in binary_safe_diff.sh.
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added a reviewer: epriestley.
dim added subscribers: eadler, stevenh.
scripts/repository/binary_safe_diff.sh
8

As exit takes an int I don't think which should be quoted

scripts/repository/binary_safe_diff.sh
8

Me neither, but I just imitated the existing coding style, which appears to quote everything.

epriestley edited edge metadata.
This revision is now accepted and ready to land.Dec 13 2015, 10:21 AM
This revision was automatically updated to reflect the committed changes.

Now that I think of it, the simplest possible way to get the desired effect (return 0 if diff succeeds, 1 if it does not succeed), is to use:

diff "$@" || exit 1

Happy to accept that if you want to double-check that it works and send me a diff for it.

(The quoting is me just being excessively-cautious/grossly-incompetent with bash, not an explicit coding style choice.)

Happy to accept that if you want to double-check that it works and send me a diff for it.

Please see D14759.