summaryrefslogtreecommitdiff
path: root/builtin/cat-file.c
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2016-07-26 18:05:57 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-07-26 11:13:44 -0700
commitf8d83fb66c653fff0541067a0b5a0821d3f548f9 (patch)
treeb18ea00e8dbbe6bca83bdf83c77724060a518ade /builtin/cat-file.c
parentdie(_("BUG")): avoid translating bug messages (diff)
downloadtgif-f8d83fb66c653fff0541067a0b5a0821d3f548f9.tar.xz
merge-recursive: clarify code in was_tracked()
It can be puzzling to see that was_tracked() asks to get an index entry by name, but does not take a negative return value for an answer. The reason we have to do this is that cache_name_pos() only looks for entries in stage 0, even if nobody asked for any stage in particular. Let's rewrite the logic a little bit, to handle the easy case early: if cache_name_pos() returned a non-negative position, we know it is a match, and we do not even have to compare the name again (cache_name_pos() did that for us already). We can say right away: yes, this file was tracked. Only if there was no exact match do we need to look harder for any matching entry in stage 2. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/cat-file.c')
0 files changed, 0 insertions, 0 deletions