Re: [PATCH] object-file: don't use object database without a repository
- From
Pushkar Singh <pushkarkumarsingh1970@gmail.com>
- Date
- Apr 5, 2026, 06:03 UTC
- Message-ID
- <CALE2CrSP0poB2u=SuWuhXNt-FLgqOTV0rmZoWYX8p6OOzpodOw@mail.gmail.com>
- In-Reply-To
- <20260404172817.2995133-1-luca.stefani.ge1@gmail.com>
Hi Luca,
Thanks for the patch, this was interesting to read.
[snip]
> When git diff is invoked without a backing repository, > INDEX_WRITE_OBJECT is never set in flags, meaning only the hash is > needed and nothing should be written to the object store.
From my understanding, this avoids using the object database in non-repository scenarios by forcing the use of index_core() when INDEX_WRITE_OBJECT is not set, which makes sense since we only need the hash in that case.
I had a small question regarding coverage:
- Do we already have tests for cases like: git diff -- <file1> <file2> outside a repository, especially with large files triggering this path?
It might be useful to add one to ensure this behavior is preserved.
Also, are there any other callers of index_fd() that might rely on similar assumptions about repository initialization?
Thanks, Pushkar