Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-09-08 04:42:28 +0300
committerJunio C Hamano <gitster@pobox.com>2021-09-08 08:41:09 +0300
commit5dc16756b220429ca91cbf263b936764f83cd4bb (patch)
tree2367982a35834fedb830ea28d46c0c216b320daf /sparse-index.c
parent72d84ea347249c525712987b85ab16fdbb5e38c1 (diff)
sparse-index: silently return when cache tree fails
If cache_tree_update() returns a non-zero value, then it could not create the cache tree. This is likely due to a path having a merge conflict. Since we are already returning early, let's return silently to avoid making it seem like we failed to write the index at all. If we remove our dependence on the cache tree within convert_to_sparse(), then we could still recover from this scenario and have a sparse index. 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 'sparse-index.c')
-rw-r--r--sparse-index.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sparse-index.c b/sparse-index.c
index cd6e0d5f40..d9b0769595 100644
--- a/sparse-index.c
+++ b/sparse-index.c
@@ -178,10 +178,12 @@ int convert_to_sparse(struct index_state *istate)
/* Clear and recompute the cache-tree */
cache_tree_free(&istate->cache_tree);
- if (cache_tree_update(istate, 0)) {
- warning(_("unable to update cache-tree, staying full"));
- return -1;
- }
+ /*
+ * Silently return if there is a problem with the cache tree update,
+ * which might just be due to a conflict state in some entry.
+ */
+ if (cache_tree_update(istate, 0))
+ return 0;
remove_fsmonitor(istate);