From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH/RFC] Document format of basic Git objects
Date: Wed, 15 Feb 2012 20:22:20 +0700 [thread overview]
Message-ID: <1329312140-24089-1-git-send-email-pclouds@gmail.com> (raw)
Basic objects' format is pretty simple and (I think) well-known.
However it's good that we document them. At least we can keep track of
the evolution of an object format. The commit object, for example,
over the years has learned "encoding" and recently GPG signing.
This is just a draft text with a bunch of fixmes. But I'd like to hear
from the community if this is a worthy effort. If so, then whether
git-cat-file is a proper place for it. Or maybe we put relevant text
in commit-tree, write-tree and mktag, then refer to them in cat-file
because cat-file can show raw objects.
So comments?
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
PS. This also makes me wonder if tag object supports "encoding".
Haven't dug down in history yet.
Documentation/git-cat-file.txt | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index 2fb95bb..e3dd6d9 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -100,6 +100,46 @@ for each object specified on stdin that does not exist in the repository:
<object> SP missing LF
------------
+OBJECT FORMAT
+-------------
+
+Tree object consists of a series of tree entries sorted in memcmp()
+order by entry name. Each entry consists of:
+
+- POSIX file mode encoded in octal ascii
+- One space character
+- Entry name terminated by one character NUL
+- 20 byte SHA-1 of the entry
+
+Tag object is ascii plain text in a format similar to email format
+(RFC 822). It consists of a header and a body, separated by a blank
+line. The header includes exactly four fields in the following order:
+
+1. "object" field, followed by SHA-1 in ascii of the tagged object
+2. "type" field, followed by the type in ascii of the tagged object
+ (either "commit", "tag", "blob" or "tree" without quotes,
+ case-sensitive)
+3. "tag" field, followed by the tag name
+4. "tagger" field, followed by the <XXX, to be named>
+
+The tag body contains the tag's message and possibly GPG signature.
+
+Commit object is in similar format to tag object. The commit body is
+in plain text of the chosen encoding (by default UTF-8). The commit
+header has the following fields in listed order
+
+1. One "tree" field, followed by the commit's tree's SHA-1 in ascii
+2. Zero, one or more "parent" field
+3. One "author" field, in <XXX to be named> format
+3. One "committer" field, in <XXX to be named> format
+4. Optionally one "encoding" field, followed by the encoding used for
+ commit body
+5. GPG signature (fixme)
+
+More headers after these fields are allowed. Unrecognized header
+fields must be kept untouched if the commit is rewritten. However, a
+compliant Git implementation produces the above header fields only.
+
GIT
---
Part of the linkgit:git[1] suite
--
1.7.8.36.g69ee2
next reply other threads:[~2012-02-15 13:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 13:22 Nguyễn Thái Ngọc Duy [this message]
2012-02-15 17:31 ` [PATCH/RFC] Document format of basic Git objects Jonathan Nieder
2012-02-15 19:48 ` Junio C Hamano
2012-02-16 7:12 ` Junio C Hamano
2012-02-19 4:15 ` [PATCH/RFC v2] " Nguyễn Thái Ngọc Duy
2012-02-19 8:39 ` Junio C Hamano
2012-02-19 9:14 ` Junio C Hamano
2012-02-20 13:55 ` Nguyen Thai Ngoc Duy
2012-02-20 16:11 ` Jeff King
2012-02-19 18:07 ` Manually decoding a git object Philip Oakley
2012-02-20 4:45 ` 徐迪
2012-02-20 8:19 ` Philip Oakley
2012-02-20 8:29 ` Thomas Rast
2012-02-20 10:19 ` Philip Oakley
2012-02-20 10:56 ` Thomas Rast
2012-02-20 11:39 ` 徐迪
2012-02-20 18:27 ` Philip Oakley
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=1329312140-24089-1-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/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).