git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 3/3] split-index: it really is incompatible with the sparse index
Date: Wed, 19 Jan 2022 17:29:39 +0000	[thread overview]
Message-ID: <1bb57ccd61452124119bb663f5e35e9676748c82.1642613380.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1119.git.1642613379.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

... at least for now. So let's error out if we are even trying to
initialize the split index when the index is sparse, or when trying to
write the split index extension for a sparse index.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 read-cache.c  | 3 +++
 split-index.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/read-cache.c b/read-cache.c
index cbe73f14e5e..a932e01fc7a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -3009,6 +3009,9 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
 	    !is_null_oid(&istate->split_index->base_oid)) {
 		struct strbuf sb = STRBUF_INIT;
 
+		if (istate->sparse_index)
+			die(_("cannot write split index for a sparse index"));
+
 		err = write_link_extension(&sb, istate) < 0 ||
 			write_index_ext_header(f, eoie_c, CACHE_EXT_LINK,
 					       sb.len) < 0;
diff --git a/split-index.c b/split-index.c
index 8e52e891c3b..9d0ccc30d00 100644
--- a/split-index.c
+++ b/split-index.c
@@ -5,6 +5,9 @@
 struct split_index *init_split_index(struct index_state *istate)
 {
 	if (!istate->split_index) {
+		if (istate->sparse_index)
+			die(_("cannot use split index with a sparse index"));
+
 		CALLOC_ARRAY(istate->split_index, 1);
 		istate->split_index->refcount = 1;
 	}
-- 
gitgitgadget

  parent reply	other threads:[~2022-01-19 17:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 17:29 [PATCH 0/3] [Non-critical]: sparse index vs split index fixes Johannes Schindelin via GitGitGadget
2022-01-19 17:29 ` [PATCH 1/3] sparse-index: sparse index is disallowed when split index is active Johannes Schindelin via GitGitGadget
2022-01-22  1:42   ` Junio C Hamano
2022-01-22  9:30     ` Johannes Schindelin
2022-01-19 17:29 ` [PATCH 2/3] t1091: disable split index Johannes Schindelin via GitGitGadget
2022-01-19 17:29 ` Johannes Schindelin via GitGitGadget [this message]
2022-01-21 23:39   ` [PATCH 3/3] split-index: it really is incompatible with the sparse index Junio C Hamano
2022-01-22  9:32     ` Johannes Schindelin
2022-01-22  5:44 ` [PATCH 0/3] [Non-critical]: sparse index vs split index fixes Elijah Newren
2022-01-22  9:31   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bb57ccd61452124119bb663f5e35e9676748c82.1642613380.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).