diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-10-27 12:33:58 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-05 13:47:45 -0800 |
| commit | 9dfa7ac3be181210dafd09ad68d10790a0810e18 (patch) | |
| tree | d0694dbf021f20a81f83606159b9ebc72f3959c3 /cache-tree.c | |
| parent | add-patch: add support for in-memory index patching (diff) | |
| download | git-9dfa7ac3be181210dafd09ad68d10790a0810e18.tar.gz git-9dfa7ac3be181210dafd09ad68d10790a0810e18.zip | |
cache-tree: allow writing in-memory index as tree
The function `write_in_core_index_as_tree()` takes a repository and
writes its index into a tree object. What this function cannot do though
is to take an _arbitrary_ in-memory index.
Introduce a new `struct index_state` parameter so that the caller can
pass a different index than the one belonging to the repository. This
will be used in a subsequent commit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.c')
| -rw-r--r-- | cache-tree.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cache-tree.c b/cache-tree.c index 2aba47060e..b67d0d703d 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -699,11 +699,11 @@ static int write_index_as_tree_internal(struct object_id *oid, return 0; } -struct tree* write_in_core_index_as_tree(struct repository *repo) { +struct tree *write_in_core_index_as_tree(struct repository *repo, + struct index_state *index_state) { struct object_id o; int was_valid, ret; - struct index_state *index_state = repo->index; was_valid = index_state->cache_tree && cache_tree_fully_valid(index_state->cache_tree); @@ -723,7 +723,6 @@ struct tree* write_in_core_index_as_tree(struct repository *repo) { return lookup_tree(repo, &index_state->cache_tree->oid); } - int write_index_as_tree(struct object_id *oid, struct index_state *index_state, const char *index_path, int flags, const char *prefix) { int entries, was_valid; |
