From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [PATCH] Technical details about the index file format.
Date: Mon, 11 Feb 2008 07:28:55 +0100 [thread overview]
Message-ID: <1202711335-12026-1-git-send-email-robin.rosenberg@dewire.com> (raw)
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
Documentation/technical/index-format.txt | 91 ++++++++++++++++++++++++++++++
1 files changed, 91 insertions(+), 0 deletions(-)
create mode 100644 Documentation/technical/index-format.txt
I believe the main index details are accurate. Anything else to explain. The
TREE section probably needs more details.
-- robin
diff --git a/Documentation/technical/index-format.txt b/Documentation/technical/index-format.txt
new file mode 100644
index 0000000..c57b382
--- /dev/null
+++ b/Documentation/technical/index-format.txt
@@ -0,0 +1,91 @@
+GIT index format
+================
+
+= The git index file has the following format
+
+ All binary numbers are in network byte order.
+
+ - A twelve byte header consisting of
+
+ 4 byte signature:
+ The signature is { 'D', 'I', 'R', 'C' }
+
+ 4 byte version number:
+ The current version is 2
+
+ 32-bit number of index entries.
+
+ - An entry consists of
+
+ 32-bit ctime seconds, the last time a file's metadata changed
+ this is stat(2) data
+
+ 32-bit ctime nanoseconds (modulo 1G)
+ this is stat(2) data
+
+ 32-bit mtime seconds, the last time a file's data changed
+ this is stat(2) data
+
+ 32-bit mtime nanoseconds (modulo 1G)
+ this is stat(2) data
+
+ 32-bit dev
+ this is stat(2) data
+
+ 32-bit uid
+ this is stat(2) data
+
+ 32-bit gid
+ this is stat(2) data
+
+ 32-bit file size
+ This is the on-disk size from stat(2)
+
+ 160-bit SHA-1 for the represented blob
+
+ A 16-bit field split into (high to low bits)
+
+ 1-bit assume-valid flag
+
+ 1-bit update-needed flag
+
+ 2-bit stage (during merge)
+
+ 12-bit name length
+
+ Name (variable length) - encoding is undefined
+
+ 1-8 nul bytes as necessary to pad the entry to a multiple ot eight bytes
+ while keeping the name NUL-terminated.
+
+ - Extensions
+
+ The only know index extension today is a tree cache. It contains
+ pre-computes hashes for all trees that can be derived from the index
+
+ 4 byte extension signature. If the first byte is 'A'..'Z' the
+ extension is optional and can be ignored.
+
+ 32-bit size of the extension
+
+ Extension data
+
+ - 160-bit SHA-1 over the content of the index file before this checksum.
+
+
+== Tree cache
+
+ - Extension tag { 'T', 'R', 'E', 'E' }
+
+ - 32-bit size
+
+ - A number of entries
+
+ NUL-terminated tree name
+
+ Blank-terminated ASCII decimal number of entries in this tree
+
+ Newline-terminated position of this tree in the parent tree. 0 for
+ the root tree
+
+ 160-bit SHA-1 for this tree and it's children
--
1.5.4.rc4.25.g81cc
next reply other threads:[~2008-02-11 6:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 6:28 Robin Rosenberg [this message]
2008-02-11 12:00 ` [PATCH] Technical details about the index file format Tim Stoakes
2008-02-11 19:27 ` Junio C Hamano
2010-08-31 0:59 ` Sverre Rabbelier
2010-08-31 7:08 ` Ramkumar Ramachandra
2010-08-31 14:23 ` Jonathan Nieder
2010-08-31 22:12 ` Nguyen Thai Ngoc Duy
2010-09-01 2:28 ` Sverre Rabbelier
2010-09-01 2:52 ` Nguyen Thai Ngoc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1202711335-12026-1-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).