git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Luca StefaniNext: Jeff King
Message 2 of 10 in “object-file: don't use object database without a repository”
  1. object-file: don't use object database without a repositoryLuca Stefani, Apr 4, 2026
  2. Pushkar SinghApr 5, 2026
  3. Jeff KingApr 5, 2026
  4. Luca StefaniApr 5, 2026
  5. Jeff KingApr 5, 2026
  6. Justin ToblerApr 6, 2026
  7. Luca StefaniApr 6, 2026
  8. Justin ToblerApr 6, 2026
  9. Jeff KingApr 6, 2026
  10. Justin ToblerApr 6, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.