Re: [PATCH 1/2] apply: guard against renames of non-existant empty files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 27, 2017, 20:10 UTC
- Message-ID
- <xmqqinnvwg2d.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <baf195cc-ef81-bbad-4e01-4149498efedb@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 6 quoted lines
> 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.
> 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.