diff options
author | Derrick Stolee <stolee@gmail.com> | 2024-06-28 12:43:23 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-28 12:32:11 -0700 |
commit | 23dd6f8bcc11fc4a468f0863b64f3ebe27a173cd (patch) | |
tree | e3caf08d1411312dd44f300e5b21c54ffced51e2 /replace-object.c | |
parent | b746a85d9a0d2384d3219b3b53593ccb880f3124 (diff) |
sparse-index: use strbuf in path_found()
The path_found() method previously reused strings from the cache entries
the calling methods were using. This prevents string manipulation in
place and causes some odd reallocation before the final lstat() call in
the method.
Refactor the method to use strbufs and copy the path into the strbuf,
but also only the parent directory and not the whole path. This looks
like extra copying when assigning the path to the strbuf, but we save an
allocation by dropping the 'tmp' string, and we are "reusing" the copy
from 'tmp' to put the data in the strbuf.
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'replace-object.c')
0 files changed, 0 insertions, 0 deletions