{"thread":{"id":"8683","subject":"Possible BUG in 'git log -z' last commit is not '\\0' terminated","startedAt":"2007-06-22T19:27:16Z","lastAt":"2007-06-23T05:51:07Z","messageCount":4,"participants":["Marco Costalba","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"45579","messageId":"e5bfff550706221227x4b785698taabfa7572bf8204b@mail.gmail.com","threadId":"8683","inReplyTo":null,"subject":"Possible BUG in 'git log -z' last commit is not '\\0' terminated","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-06-22T19:27:16Z","receivedAt":"2007-06-22T19:27:16Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"It seems '-z' option is not honoured by the last revision printed that\nis just '\\n' terminated.\n\nThanks\nMarco\n"},{"id":"45581","messageId":"7vlkebada8.fsf@assigned-by-dhcp.pobox.com","threadId":"8683","inReplyTo":"e5bfff550706221227x4b785698taabfa7572bf8204b@mail.gmail.com","subject":"Re: Possible BUG in 'git log -z' last commit is not '\\0' terminated","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-22T21:29:35Z","receivedAt":"2007-06-22T21:29:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I am a bit busy right now and do not have time to dig into this,\nbut I suspect the LF you are seeing at the end belongs to the\ncommit log of the last entry, as I think -z is not about\ntermination but separation.\n"},{"id":"45582","messageId":"alpine.LFD.0.98.0706221451570.3593@woody.linux-foundation.org","threadId":"8683","inReplyTo":"e5bfff550706221227x4b785698taabfa7572bf8204b@mail.gmail.com","subject":"Re: Possible BUG in 'git log -z' last commit is not '\\0' terminated","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-06-22T21:56:10Z","receivedAt":"2007-06-22T21:56:10Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 22 Jun 2007, Marco Costalba wrote:\n>\n> It seems '-z' option is not honoured by the last revision printed that\n> is just '\\n' terminated.\n\nIt's not a bug - it's by design.\n\nWhat the -z option does is to replace the normal \"\\n\" that delineates \ncommits from each other with a \"\\0\".\n\nAnd we only put that delimeter in *between* commits, not *after* commits. \nThe reason? It's prettier. Do a \n\n\tgit log -1\n\nto get a single commit, and notice how we do *not* add an empty line at \nthe end (or beginning), and compare that to\n\n\tgit log -2\n\nthat shows two commits, and has an empty line in *between*.\n\nNow, add the \"-z\" flag, and notice how that empty line is now replaced by \na \"\\0\" character instead.\n\nSo you should think of the \"\\0\" as being a delimeter that goes between\ncommits, not something that \"ends\" the commit. It's not a \"end of record\" \nthing, it's a \"between records\" thing.\n\n\t\tLinus\n"},{"id":"45591","messageId":"e5bfff550706222251kdc6ccb4s6caf0195682ab727@mail.gmail.com","threadId":"8683","inReplyTo":"alpine.LFD.0.98.0706221451570.3593@woody.linux-foundation.org","subject":"Re: Possible BUG in 'git log -z' last commit is not '\\0' terminated","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-06-23T05:51:07Z","receivedAt":"2007-06-23T05:51:07Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 6/22/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:\n>\n> So you should think of the \"\\0\" as being a delimeter that goes between\n> commits, not something that \"ends\" the commit. It's not a \"end of record\"\n> thing, it's a \"between records\" thing.\n>\n\nThanks for explanation.\n\nInteresting enough git-dif-tree with -z, documented as\n\n\"-z  \\0 line termination on output\"\n\nhas a different behaviour, with and without -p option:\n\ngit diff-tree -z HEAD ---> a '\\0' is printed at the end\n\ngit diff-tree -z -p HEAD --> No '\\0' is printed.\n\nI suppose 'git log' passes '-z' to 'git diff-tree' because no\ndocumentation exsists in 'git log' man page.\n\nThanks\nMarco\n\nBTW git-rev-list --header uses '\\0' differently (appends to each\nrecord), but that's another story.\n"}]}