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

Re: [PATCH 1/1] read-cache: update index format default to v4

From
Stefan Beller <sbeller@google.com>
Date
Sep 25, 2018, 18:01 UTC
Message-ID
<CAGZ79kZEN9pSBAdVajfRrrb_D3twD+C7hnzZti+TqO0-sVp9PA@mail.gmail.com>
In-Reply-To
<4d276a77-0ac9-c1d1-b5de-3ded394efb0b@gmail.com>
On Tue, Sep 25, 2018 at 7:30 AM Derrick Stolee <stolee@gmail.com> wrote:
Show 37 quoted lines
>
> On 9/25/2018 3:06 AM, Patrick Steinhardt wrote:
> > On Mon, Sep 24, 2018 at 11:32:23PM +0200, SZEDER Gábor wrote:
> >> On Mon, Sep 24, 2018 at 02:15:30PM -0700, Derrick Stolee via GitGitGadget wrote:
> >>> From: Derrick Stolee <dstolee@microsoft.com>
> >>>
> >>> The index v4 format has been available since 2012 with 9d22778
> >>> "reach-cache.c: write prefix-compressed names in the index". Since
> >>> the format has been stable for so long, almost all versions of Git
> >>> in use today understand version 4, removing one barrier to upgrade
> >>> -- that someone may want to downgrade and needs a working repo.
> >> What about alternative implementations, like JGit, libgit2, etc.?
> > Speaking of libgit2, we are able to read and write index v4 since
> > commit c1b370e93
>
> This is a good point, Szeder.
>
> Patrick: I'm glad LibGit2 is up-to-date with index formats.
>
> Unfortunately, taking a look (for the first time) at the JGit code
> reveals that they don't appear to have v4 support. In
> org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java, the
> DirCache.readFrom() method: lines 488-494, I see the following snippet:
>
>                  final int ver = NB.decodeInt32(hdr, 4);
>                  boolean extended = false;
>                  if (ver == 3)
>                          extended = true;
>                  else if (ver != 2)
>                          throw new
> CorruptObjectException(MessageFormat.format(
> JGitText.get().unknownDIRCVersion, Integer.valueOf(ver)));
>
> It looks like this will immediately throw with versions other than 2 or 3.
>
> I'm adding Jonathan Nieder to CC so he can check with JGit people about
> the impact of this change.

JGit is used both on the server (which doesn't use index/staging area) as well as client side as e.g. an Eclipse integration, which would very much like to use the index.

Adding Matthias Sohn as well, who is active in JGit and cares more about the client side than Googlers who only make use of the server side part of JGit.

Stefan
Previous: Derrick StoleeNext: Ben Peart
Message 7 of 9 in “read-cache: update index format default to v4”
  1. 0/1 read-cache: update index format default to v4Derrick Stolee via GitGitGadget, Sep 24, 2018
  2. 1/1 read-cache: update index format default to v4Derrick Stolee via GitGitGadget, Sep 24, 2018
  3. SZEDER GáborSep 24, 2018
  4. Junio C HamanoSep 24, 2018
  5. Patrick SteinhardtSep 25, 2018
  6. Derrick StoleeSep 25, 2018
  7. Stefan BellerSep 25, 2018
  8. Ben PeartSep 25, 2018
  9. Matthias SohnSep 26, 2018

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.