Thread (3 messages) flat view 3 messages, 2 authors, 2017-06-27

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

From: René Scharfe <hidden>
Date: 2017-02-27 22:20:48

Possibly related (same subject, not in this thread)

Am 27.02.2017 um 21:10 schrieb Junio C Hamano:
René Scharfe [off-list ref] writes:
quoted
Would it make sense to mirror the previously existing condition and
check for is_new instead?  I.e.:

			if ((!patch->is_delete && !patch->new_name) ||
			    (!patch->is_new    && !patch->old_name)) {
Yes, probably.
quoted
or

			if (!(patch->is_delete || patch->new_name) ||
			    !(patch->is_new    || patch->old_name)) {
This happens after calling parse_git_header() so we should know the
actual value of is_delete and is_new by now (instead of mistaking
-1 aka "unknown" as true), so this rewrite would also be OK.
The two variants are logically equivalent -- (!a && !b) == !(a || b).  I 
wonder if the second one may be harder to read, though.

René
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help