summaryrefslogtreecommitdiff
path: root/builtin/merge-index.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-04-01 01:49:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-14 20:47:21 (GMT)
commit299e2c4561ba6eb99e367b1f73b8ffb3cead5efa (patch)
tree22f3e2a45b7923929eba880e73111d062d5e76df /builtin/merge-index.c
parent42f44e84eb3be06f463ebc33baa2fc91423f4470 (diff)
downloadgit-299e2c4561ba6eb99e367b1f73b8ffb3cead5efa.zip
git-299e2c4561ba6eb99e367b1f73b8ffb3cead5efa.tar.gz
git-299e2c4561ba6eb99e367b1f73b8ffb3cead5efa.tar.bz2
merge-index: ensure full index
Before iterating over all cache entries, ensure that a sparse index is expanded to a full one to avoid unexpected behavior. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-index.c')
-rw-r--r--builtin/merge-index.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/merge-index.c b/builtin/merge-index.c
index 38ea6ad..c0383fe 100644
--- a/builtin/merge-index.c
+++ b/builtin/merge-index.c
@@ -58,6 +58,8 @@ static void merge_one_path(const char *path)
static void merge_all(void)
{
int i;
+ /* TODO: audit for interaction with sparse-index. */
+ ensure_full_index(&the_index);
for (i = 0; i < active_nr; i++) {
const struct cache_entry *ce = active_cache[i];
if (!ce_stage(ce))
@@ -80,6 +82,9 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix)
read_cache();
+ /* TODO: audit for interaction with sparse-index. */
+ ensure_full_index(&the_index);
+
i = 1;
if (!strcmp(argv[i], "-o")) {
one_shot = 1;