Merge branch 'rs/cache-tree-strbuf-growth-fix'
Remove unnecessary explicit sizing of strbuf. * rs/cache-tree-strbuf-growth-fix: cache-tree: fix strbuf growth in prime_cache_tree_rec()
This commit is contained in:
commit
a42d69ee5b
@ -760,7 +760,7 @@ static void prime_cache_tree_rec(struct repository *r,
|
|||||||
struct tree_desc desc;
|
struct tree_desc desc;
|
||||||
struct name_entry entry;
|
struct name_entry entry;
|
||||||
int cnt;
|
int cnt;
|
||||||
int base_path_len = tree_path->len;
|
size_t base_path_len = tree_path->len;
|
||||||
|
|
||||||
oidcpy(&it->oid, &tree->object.oid);
|
oidcpy(&it->oid, &tree->object.oid);
|
||||||
|
|
||||||
@ -785,7 +785,6 @@ static void prime_cache_tree_rec(struct repository *r,
|
|||||||
*/
|
*/
|
||||||
if (r->index->sparse_index) {
|
if (r->index->sparse_index) {
|
||||||
strbuf_setlen(tree_path, base_path_len);
|
strbuf_setlen(tree_path, base_path_len);
|
||||||
strbuf_grow(tree_path, base_path_len + entry.pathlen + 1);
|
|
||||||
strbuf_add(tree_path, entry.path, entry.pathlen);
|
strbuf_add(tree_path, entry.path, entry.pathlen);
|
||||||
strbuf_addch(tree_path, '/');
|
strbuf_addch(tree_path, '/');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user