{"thread":{"id":"27502","subject":"tag format and tests","startedAt":"2011-05-30T14:12:30Z","lastAt":"2011-05-30T16:09:55Z","messageCount":3,"participants":["David Glesser","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169000","messageId":"db6ec478a7cb9b963d90651f5315ffec@ensimag.fr","threadId":"27502","inReplyTo":null,"subject":"tag format and tests","fromName":"David Glesser","fromEmail":"glesserd@ensimag.fr","sentAt":"2011-05-30T14:12:30Z","receivedAt":"2011-05-30T14:12:30Z","isPatch":false,"sender":{"key":"glesserd@ensimag.fr","avatar":null},"body":"Hello,\n\nWe are currently coding a minimal git client using libgit2. We use git\ntests to test our git client. We have an error caused by the tag format\nused by libgit2.\nThe test t1006-cat-file.sh report many errors, the first one is:\nnot ok - 23 Size of tag is correct\nThis error comes from libgit2 and how it writes the timestamp, see below:\n\n$ cat tag && echo\nobject 5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689\ntype blob\ntag hellotag\ntagger SpongeBob <spongebob.square@crusty-crabs.com> 0000000000 +0000\n\ncheeseburger\n$ git mktag < tag\n7eade44ddd1b9ee24a44e0b2dde2561efea7f7d6\n$ echo 7eade44ddd1b9ee24a44e0b2dde2561efea7f7d6 | git cat-file --batch\n7eade44ddd1b9ee24a44e0b2dde2561efea7f7d6 tag 154\nobject 5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689\ntype blob\ntag hellotag\ntagger SpongeBob <spongebob.square@crusty-crabs.com> 0000000000 +0000\n\ncheeseburger\n\n\nAnd now using libgit2 :\n\n$ git2 mktag < tag\n49bc784cd2071c97a14841b3eab1181dd1c8fbcd\n$ echo 49bc784cd2071c97a14841b3eab1181dd1c8fbcd | git cat-file --batch\n49bc784cd2071c97a14841b3eab1181dd1c8fbcd tag 145\nobject 5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689\ntype blob\ntag hellotag\ntagger SpongeBob <spongebob.square@crusty-crabs.com> 0 +0000\n\ncheeseburger\n\nBoth formats are accepted by git.\nIt's reasonable to say that the test is wrong because it doesn't fit\nexactly with the format ?\n\n\nDavid G.\n"},{"id":"169006","messageId":"20110530160203.GB24431@sigill.intra.peff.net","threadId":"27502","inReplyTo":"db6ec478a7cb9b963d90651f5315ffec@ensimag.fr","subject":"Re: tag format and tests","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-05-30T16:02:03Z","receivedAt":"2011-05-30T16:02:03Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 30, 2011 at 04:12:30PM +0200, David Glesser wrote:\n\n> This error comes from libgit2 and how it writes the timestamp, see below:\n> \n> $ cat tag && echo\n> object 5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689\n> type blob\n> tag hellotag\n> tagger SpongeBob <spongebob.square@crusty-crabs.com> 0000000000 +0000\n> \n> cheeseburger\n> $ git mktag < tag\n> 7eade44ddd1b9ee24a44e0b2dde2561efea7f7d6\n> $ echo 7eade44ddd1b9ee24a44e0b2dde2561efea7f7d6 | git cat-file --batch\n> 7eade44ddd1b9ee24a44e0b2dde2561efea7f7d6 tag 154\n> object 5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689\n> type blob\n> tag hellotag\n> tagger SpongeBob <spongebob.square@crusty-crabs.com> 0000000000 +0000\n> \n> cheeseburger\n> \n> \n> And now using libgit2 :\n> \n> $ git2 mktag < tag\n> 49bc784cd2071c97a14841b3eab1181dd1c8fbcd\n> $ echo 49bc784cd2071c97a14841b3eab1181dd1c8fbcd | git cat-file --batch\n> 49bc784cd2071c97a14841b3eab1181dd1c8fbcd tag 145\n> object 5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689\n> type blob\n> tag hellotag\n> tagger SpongeBob <spongebob.square@crusty-crabs.com> 0 +0000\n> \n> cheeseburger\n> \n> Both formats are accepted by git.\n\nYes, both are valid timestamps. And git itself, when creating a tag via\n\"git tag\", will not write silly leading zeroes. But in this test, we are\nusing mktag, which is creating a tag object from already-formatted\ninput. So the question is not whether the date-formatting is a problem,\nbut rather whether mktag should do be doing _any_ modification or\ncanonicalization of its input at all.\n\nAnd I think the answer is \"no\", because we may be handing gpg-signed\ncontents to mktag, and any change could invalidate that signature. So\nlibgit2 is wrong to munge the data.\n\nI imagine your code parses the buffer into a tag object, checks that it\nparsed properly, then writes out that object. I think instead you need\nto parse the buffer into a tag object, check that it parsed, and then\nwrite the _original_ buffer into a tag object.\n\n-Peff\n"},{"id":"169007","messageId":"daee28953084189497dd2f2c8988cd03@ensimag.fr","threadId":"27502","inReplyTo":"20110530160203.GB24431@sigill.intra.peff.net","subject":"Re: tag format and tests","fromName":"David Glesser","fromEmail":"glesserd@ensimag.fr","sentAt":"2011-05-30T16:09:55Z","receivedAt":"2011-05-30T16:09:55Z","isPatch":false,"sender":{"key":"glesserd@ensimag.fr","avatar":null},"body":"On Mon, 30 May 2011 12:02:03 -0400, Jeff King <peff@peff.net> wrote:\n> And I think the answer is \"no\", because we may be handing gpg-signed\n> contents to mktag, and any change could invalidate that signature. So\n> libgit2 is wrong to munge the data.\n\nOk, I will patch libgit2.\n\n> I imagine your code parses the buffer into a tag object, checks that it\n> parsed properly, then writes out that object.\n\nExactly !\n\nThanks for your answer.\n\nDavid G.\n"}]}