git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/5] cache API: always have a "istate->repo"
@ 2023-01-10  6:17 Ævar Arnfjörð Bjarmason
  2023-01-10  6:17 ` [PATCH 1/5] builtin/difftool.c: { 0 }-initialize rather than using memset() Ævar Arnfjörð Bjarmason
                   ` (6 more replies)
  0 siblings, 7 replies; 32+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2023-01-10  6:17 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Derrick Stolee, Victoria Dye, Jeff Hostetler,
	Ævar Arnfjörð Bjarmason

The "struct index_state" contains a "repo" member, which should be a
pointer to the repository for that index, but which due to us
constructing such structs on an ad-hoc basis in various places wasn't
always available.

We'd thus end up with code like this, in the recent
ds/omit-trailing-hash-in-index topic:

	struct repository *r = istate->repo ? istate->repo : the_repository;

Really we should be able to trust the "istate->repo", but were
carrying those sorts of conditionals because our index might come from
a manually constructed source, so we'd have to fall back to
"the_repository".

This series changes the relvant code so the "repo" field is always
non-NULL, as 5/5 here shows we had various workarounds in place for
that, which can now go away.

See
https://github.com/avar/git/tree/avar/do-not-lazy-populate-istate-repo
for passing CI and a fetchable branch for this topic.

See https://lore.kernel.org/git/xmqqmt6vqo2w.fsf@gitster.g/ for
previous discussion on this topic.

Ævar Arnfjörð Bjarmason (5):
  builtin/difftool.c: { 0 }-initialize rather than using memset()
  sparse-index.c: expand_to_path() can assume non-NULL "istate"
  sparse-index API: fix TODO, BUG() out on NULL ensure_full_index()
  read-cache.c: refactor set_new_index_sparsity() for subsequent commit
  treewide: always have a valid "index_state.repo" member

 apply.c                   |  2 +-
 builtin/difftool.c        |  4 +---
 builtin/sparse-checkout.c |  1 +
 builtin/stash.c           |  8 ++++----
 builtin/worktree.c        |  2 +-
 fsmonitor-settings.c      | 14 --------------
 fsmonitor.c               |  2 +-
 merge-recursive.c         |  2 +-
 read-cache.c              | 23 +++++++++--------------
 repository.c              |  2 ++
 revision.c                |  2 +-
 sparse-index.c            | 15 ++++-----------
 split-index.c             |  1 +
 unpack-trees.c            |  4 +++-
 14 files changed, 30 insertions(+), 52 deletions(-)

-- 
2.39.0.1195.gabc92c078c4


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2023-01-17 15:34 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10  6:17 [PATCH 0/5] cache API: always have a "istate->repo" Ævar Arnfjörð Bjarmason
2023-01-10  6:17 ` [PATCH 1/5] builtin/difftool.c: { 0 }-initialize rather than using memset() Ævar Arnfjörð Bjarmason
2023-01-10  6:17 ` [PATCH 2/5] sparse-index.c: expand_to_path() can assume non-NULL "istate" Ævar Arnfjörð Bjarmason
2023-01-10  6:17 ` [PATCH 3/5] sparse-index API: fix TODO, BUG() out on NULL ensure_full_index() Ævar Arnfjörð Bjarmason
2023-01-10 10:35   ` Philip Oakley
2023-01-10 12:22     ` Ævar Arnfjörð Bjarmason
2023-01-10 14:58   ` Derrick Stolee
2023-01-10  6:17 ` [PATCH 4/5] read-cache.c: refactor set_new_index_sparsity() for subsequent commit Ævar Arnfjörð Bjarmason
2023-01-10  6:17 ` [PATCH 5/5] treewide: always have a valid "index_state.repo" member Ævar Arnfjörð Bjarmason
2023-01-10 12:24   ` Ævar Arnfjörð Bjarmason
2023-01-10 13:13   ` Jeff Hostetler
2023-01-10 15:08   ` Derrick Stolee
2023-01-10 15:09 ` [PATCH 0/5] cache API: always have a "istate->repo" Derrick Stolee
2023-01-12 12:55 ` [PATCH v2 0/6] " Ævar Arnfjörð Bjarmason
2023-01-12 12:55   ` [PATCH v2 1/6] builtin/difftool.c: { 0 }-initialize rather than using memset() Ævar Arnfjörð Bjarmason
2023-01-12 12:55   ` [PATCH v2 2/6] sparse-index.c: expand_to_path() can assume non-NULL "istate" Ævar Arnfjörð Bjarmason
2023-01-12 12:55   ` [PATCH v2 3/6] sparse-index API: BUG() out on NULL ensure_full_index() Ævar Arnfjörð Bjarmason
2023-01-12 12:55   ` [PATCH v2 4/6] read-cache.c: refactor set_new_index_sparsity() for subsequent commit Ævar Arnfjörð Bjarmason
2023-01-12 12:55   ` [PATCH v2 5/6] cache API: add a "INDEX_STATE_INIT" macro/function, add release_index() Ævar Arnfjörð Bjarmason
2023-01-12 15:21     ` Derrick Stolee
2023-01-12 16:19       ` Ævar Arnfjörð Bjarmason
2023-01-12 16:47         ` Derrick Stolee
2023-01-12 12:55   ` [PATCH v2 6/6] treewide: always have a valid "index_state.repo" member Ævar Arnfjörð Bjarmason
2023-01-12 15:22     ` Derrick Stolee
2023-01-12 15:23   ` [PATCH v2 0/6] cache API: always have a "istate->repo" Derrick Stolee
2023-01-13 18:29     ` Junio C Hamano
2023-01-13 19:22   ` Junio C Hamano
2023-01-16 13:38     ` Ævar Arnfjörð Bjarmason
2023-01-16 16:53       ` Philip Oakley
2023-01-16 18:39         ` Junio C Hamano
2023-01-17 13:57           ` [PATCH] treewide: always have a valid "index_state.repo" member Ævar Arnfjörð Bjarmason
2023-01-17 15:34             ` Derrick Stolee

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).