diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-10-11 11:43:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-12 07:23:29 +0900 |
commit | 2034e848d57cda298d3ef6967a7edec4a1072573 (patch) | |
tree | dcd4eca1d7cbf440c2b800e9468679ddde1da559 /cache-tree.h | |
parent | t1700-split-index: date back files to avoid racy situations (diff) | |
download | tgif-2034e848d57cda298d3ef6967a7edec4a1072573.tar.xz |
split-index: count the number of deleted entries
'struct split_index' contains the field 'nr_deletions', whose name
with the 'nr_' prefix suggests that it contains the number of deleted
cache entries. However, barring its initialization to 0, this field
is only ever set to 1, indicating that there is at least one deleted
entry, but not the number of deleted entries. Luckily, this doesn't
cause any issues (other than confusing the reader, that is), because
the only place reading this field uses it in the same sense, i.e.: 'if
(si->nr_deletions)'.
To avoid confusion, we could either rename this field to something
like 'has_deletions' to make its name match its role, or make it a
counter of deleted cache entries to match its name.
Let's make it a counter, to keep it in sync with the related field
'nr_replacements', which does contain the number of replaced cache
entries. This will also give developers debugging the split index
code easy access to the number of deleted cache entries.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.h')
0 files changed, 0 insertions, 0 deletions