Re: [PATCH v5 17/23] userdiff.c: remove implicit dependency on the_index
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 10, 2018, 22:14 UTC
- Message-ID
- <xmqq7eipla9k.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20181010145116.GA11772@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> I get why you're doing it: your topic here only cares about removing > index dependencies, so you did the minimal thing to move that forward. > > But if you think about what this function is doing, it is quite clearly > dependent on the whole repository, since the userdiff config we're > looking up may come from repo config.
In the case of userdiff that is pretty much limited to read-only operation, I fully agree, but in more general cases, we would need to pass both the repository and an in-core index separately, I would say. Imagine doing a partial commit, where we construct a separate istate that is not the "repo's index" and use that to write out a tree object to be wrapped in a new commit, and update the current branch ref.