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)
Tue, Apr 30, 5:50 PM
Unknown Object (File)
Mon, Apr 29, 4:19 PM
Unknown Object (File)
Mon, Apr 29, 8:47 AM
Unknown Object (File)
Wed, Apr 24, 11:59 PM
Unknown Object (File)
Sat, Apr 20, 9:02 PM
Unknown Object (File)
Thu, Apr 11, 8:16 AM
Unknown Object (File)
Wed, Apr 10, 2:16 AM
Unknown Object (File)
Tue, Apr 2, 6:36 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.