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

Re: [PATCH v2] index-format.txt: be more liberal on what can represent invalid cache tree

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 13, 2012, 18:11 UTC
Message-ID
<7vk3slzusd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7v8v921zt6.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>>  How would that work with existing versions? If you write -2 in
>>  cache-tree, the next time 1.8.0 updates cache tree it writes -1 back.
>>  That loses whatever information you attach to -2. A new cache-tree
>>  extension is probably better.
>
> You can easily imagine a definition like this:
> ...

As we clarified that we do not allow implementations to write anything but -1 for invalidated entries until we decide what we will use other values for, the whole log message needs to be updated, I think.

-- >8 --
From: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date: Thu, 13 Dec 2012 08:14:47 +0700
Subject: [PATCH] index-format.txt: clarify what is "invalid"

A cache-tree entry with a negative entry count is considered "invalid" in the current Git; it records that we do not know the object name of a tree that would result by writing the directory covered by the cache-tree as a tree object.

Clarify that any entry with a negative entry count is invalid, but the implementations must write -1 there. This way, we can later decide to allow writers to use negative values other than -1 to encode optional information without harming interoperability; we do not know what is encoded how, so keep these other negative values as reserved for now.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/technical/index-format.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Documentation/technical/index-format.txt b/Documentation/technical/index-format.txt
index 9d25b30..ce28a7a 100644
--- a/Documentation/technical/index-format.txt
+++ b/Documentation/technical/index-format.txt
@@ -161,8 +161,9 @@ GIT index format
     this span of index as a tree.
 
   An entry can be in an invalidated state and is represented by having
-  -1 in the entry_count field. In this case, there is no object name
-  and the next entry starts immediately after the newline.
+  a negative number in the entry_count field. In this case, there is no
+  object name and the next entry starts immediately after the newline.
+  When writing an invalid entry, -1 should always be used as entry_count.
 
   The entries are written out in the top-down, depth-first order.  The
   first entry represents the root level of the repository, followed by the
-- 
1.8.1.rc1.141.g0ffea5d
Previous: Junio C Hamano
Message 5 of 5 in “index-format.txt: be more liberal on what can represent invalid cache tree”
  1. index-format.txt: be more liberal on what can represent invalid cache treeNguyễn Thái Ngọc Duy, Dec 12, 2012
  2. Junio C HamanoDec 12, 2012
  3. index-format.txt: be more liberal on what can represent invalid cache treeNguyễn Thái Ngọc Duy, Dec 13, 2012
  4. Junio C HamanoDec 13, 2012
  5. Junio C HamanoDec 13, 2012

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.