From: Johan Herland Date: Sat, 09 Jun 2007 00:20:04 GMT Subject: [PATCH 17/21] Update comments on tag objects in mktag.c Message-ID: <200706090220.04603.johan@herland.net> In-Reply-To: <200706090210.36270.johan@herland.net> Also update minimum tag object length to the new minimum length after refactoring. Signed-off-by: Johan Herland --- mktag.c | 30 ++++++++++++++++++++++-------- tag.c | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/mktag.c b/mktag.c index 31eadd8..af0cfa6 100644 --- a/mktag.c +++ b/mktag.c @@ -2,16 +2,30 @@ #include "tag.h" /* - * A signature file has a very simple fixed format: four lines - * of "object " + "type " + "tag " + + * Tag object data has the following format: two mandatory lines of + * "object " + "type ", plus two optional lines of + * "tag " + "keywords ", plus a mandatory line of * "tagger ", followed by a blank line, a free-form tag - * message and a signature block that git itself doesn't care about, - * but that can be verified with gpg or similar. + * message and an optional signature block that git itself doesn't + * care about, but that can be verified with gpg or similar. * - * The first three lines are guaranteed to be at least 63 bytes: - * "object \n" is 48 bytes, "type tag\n" at 9 bytes is the - * shortest possible type-line, and "tag .\n" at 6 bytes is the - * shortest single-character-tag line. + * represents the object pointed to by this tag, is + * the type of the object pointed to ("tag", "blob", "tree" or "commit"), + * is the name of this tag object (and must correspond to the + * name of the corresponding ref (if any) in '.git/refs/'). is + * a comma-separated list of keywords associated with this tag object, and + * holds the "name " of the tag creator and timestamp + * of when the tag object was created (analogous to "committer" in commit + * objects). + * + * The first two lines are guaranteed to be at least 57 bytes: + * "object \n" is 48 bytes, and "type tag\n" at 9 bytes is + * the shortest possible "type" line. The tagger line is at least + * "tagger \n" (8 bytes). Therefore a tag object _must_ have >= 65 bytes. + * + * If "tag " is omitted, defaults to the empty string. + * If "keywords " is omitted, defaults to "tag" if + * a was given, "note" otherwise. */ int main(int argc, char **argv) diff --git a/tag.c b/tag.c index 1caec19..af4356e 100644 --- a/tag.c +++ b/tag.c @@ -79,7 +79,7 @@ int parse_and_verify_tag_buffer(struct tag *item, item->object.parsed = 1; } - if (size < 64) + if (size < 65) return error("Tag object failed preliminary size check"); /* Verify mandatory object line */ -- 1.5.2