Skip to content

Commit afd7bd2

Browse files
committed
index-v4: document the entry format
Document the format so that others can learn from and build on top of the series. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9170c7a commit afd7bd2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Documentation/technical/index-format.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,22 @@ GIT index format
113113
are encoded in 7-bit ASCII and the encoding cannot contain a NUL
114114
byte (iow, this is a UNIX pathname).
115115

116+
(Version 4) In version 4, the entry path name is prefix-compressed
117+
relative to the path name for the previous entry (the very first
118+
entry is encoded as if the path name for the previous entry is an
119+
empty string). At the beginning of an entry, an integer N in the
120+
variable width encoding (the same encoding as the offset is encoded
121+
for OFS_DELTA pack entries; see pack-format.txt) is stored, followed
122+
by a NUL-terminated string S. Removing N bytes from the end of the
123+
path name for the previous entry, and replacing it with the string S
124+
yields the path name for this entry.
125+
116126
1-8 nul bytes as necessary to pad the entry to a multiple of eight bytes
117127
while keeping the name NUL-terminated.
118128

129+
(Version 4) In version 4, the padding after the pathname does not
130+
exist.
131+
119132
== Extensions
120133

121134
=== Cached tree

0 commit comments

Comments
 (0)