diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2021-01-23 22:58:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-24 04:14:07 +0300 |
commit | cae70acf2431f0c31e5c097b96fa5bd752526e6d (patch) | |
tree | b76cd1aeb458809f9f824f540c26a6ab561e6f61 /repository.c | |
parent | c80dd3967f28527dab49c8e9525524c7f33baa22 (diff) |
fsmonitor: de-duplicate BUG()s around dirty bits
The index has an fsmonitor_dirty bitmap that records which index entries
are "dirty" based on the response from the FSMonitor. If this bitmap
ever grows larger than the index, then there was an error in how it was
constructed, and it was probably a developer's bug.
There are several BUG() statements that are very similar, so replace
these uses with a simpler assert_index_minimum(). Since there is one
caller that uses a custom 'pos' value instead of the bit_size member, we
cannot simplify it too much. However, the error string is identical in
each, so this simplifies things.
Be sure to add one when checking if a position if valid, since the
minimum is a bound on the expected size.
The end result is that the code is simpler to read while also preserving
these assertions for developers in the FSMonitor space.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
0 files changed, 0 insertions, 0 deletions