]> git.ipfire.org Git - thirdparty/git.git/commit - apply.c
apply: code simplification
authorJunio C Hamano <gitster@pobox.com>
Tue, 26 Dec 2023 23:32:18 +0000 (15:32 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Dec 2023 05:20:32 +0000 (21:20 -0800)
commit45b625142d8ca2218af1fb2b37216e58953e775d
treefe2f7df714cf0d4cfac8bae919358bb8371110dc
parent01aff0ae85af100c4d88df753078158b82774ea0
apply: code simplification

Rewrite a bit hard-to-read ternary ?: expression into a cascade of
if/else.

Given that read-cache.c:add_index_entry() makes sure that the
.ce_mode member is filled with a reasonable value before placing a
cache entry in the index, if we see (ce_mode == 0), there is
something seriously wrong going on.  Catch such a bug and abort,
instead of silently ignoring such an entry and silently skipping
the check.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c