Shuqi Liang <cheskaqiqi@xxxxxxxxx> writes: > + pos = index_name_pos_sparse(istate, path, strlen(path)); > + pos = -pos-2; With SP at appropriate places, i.e. "pos = -pos - 2". But more importantly, where does the -2 come from? For a missing entry, we get a negative number, and the location that the cache entry with the given path would be inserted can be recovered by computing -pos - 1, and that is why if (0 <= pos) { ... handle existing ce at pos ... } else if (pos < 0) { pos = -pos - 1; ... if such a path were in the index, it would have ... been at pos } looks fairly familiar to those who have read our code. Even in such a case, we do not blindly compute "-pos - 1", though. In any case, this magic "adjustment" of the returned value needs to be explained, perhaps in in-code comment around there. > + if (!path_in_cone_mode_sparse_checkout(path, istate) && pos>=0) { With SP at appropriate places, i.e. " && 0 <= pos". Thanks.