{"thread":{"id":"508","subject":"[PATCH] Tweak git-diff-tree -v output further (take 2).","startedAt":"2005-05-06T19:37:00Z","lastAt":"2005-05-06T22:05:14Z","messageCount":4,"participants":["Junio C Hamano","Linus Torvalds","H. Peter Anvin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2701","messageId":"7vbr7ocfj7.fsf@assigned-by-dhcp.cox.net","threadId":"508","inReplyTo":null,"subject":"[PATCH] Tweak git-diff-tree -v output further (take 2).","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-06T19:37:00Z","receivedAt":"2005-05-06T19:37:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"(This one is simpler than the previous one I just sent out)\n\nThe first hunk of this is a pure bugfix---it guards us against a\ncommit message that does not end with a newline.\n\nThis adds the full header information to git-diff-tree -v output\nin addition to the log message it already produces.  It also\nstops indenting the log message to match what git-export does.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\ndiff-tree.c |   22 ++++++++++++----------\n1 files changed, 12 insertions(+), 10 deletions(-)\n\n# - linus-mirror: diff-tree: add \"verbose header\" mode\n# + (working tree)\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -278,7 +278,7 @@ static int get_one_line(const char *msg,\n \n \twhile (len--) {\n \t\tret++;\n-\t\tif (*msg++ == '\\n')\n+\t\tif (!*msg || *msg++ == '\\n')\n \t\t\tbreak;\n \t}\n \treturn ret;\n@@ -287,12 +287,14 @@ static int get_one_line(const char *msg,\n static char *generate_header(const char *commit, const char *parent, const char *msg, unsigned long len)\n {\n \tstatic char this_header[1000];\n-\tint offset;\n \n-\toffset = sprintf(this_header, \"%s%s (from %s)\\n\", header_prefix, commit, parent);\n-\tif (verbose_header) {\n+\tif (!verbose_header)\n+\t\tsprintf(this_header, \"%s%s (from %s)\\n\", header_prefix,\n+\t\t\tcommit, parent);\n+\telse {\n+\t\tint offset;\n \t\tint hdr = 1;\n-\n+\t\toffset = sprintf(this_header, \"Id: %s\\n\", commit);\n \t\tfor (;;) {\n \t\t\tconst char *line = msg;\n \t\t\tint linelen = get_one_line(msg, len);\n@@ -306,11 +308,11 @@ static char *generate_header(const char \n \t\t\tlen -= linelen;\n \t\t\tif (linelen == 1)\n \t\t\t\thdr = 0;\n-\t\t\tif (hdr)\n-\t\t\t\tcontinue;\n-\t\t\tmemset(this_header + offset, ' ', 4);\n-\t\t\tmemcpy(this_header + offset + 4, line, linelen);\n-\t\t\toffset += linelen + 4;\n+\t\t\tmemcpy(this_header + offset, line, linelen);\n+\t\t\tif (hdr && !strncmp(line, \"parent \", 7) &&\n+\t\t\t    !strncmp(line+7, parent, 40))\n+\t\t\t\tthis_header[offset + 6] = '*';\n+\t\t\toffset += linelen;\n \t\t}\n \t\tthis_header[offset++] = '\\n';\n \t\tthis_header[offset] = 0;\n\n"},{"id":"2709","messageId":"Pine.LNX.4.58.0505061440180.2233@ppc970.osdl.org","threadId":"508","inReplyTo":"7vbr7ocfj7.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Tweak git-diff-tree -v output further (take 2).","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-06T21:40:50Z","receivedAt":"2005-05-06T21:40:50Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 6 May 2005, Junio C Hamano wrote:\n> \n> The first hunk of this is a pure bugfix---it guards us against a\n> commit message that does not end with a newline.\n\nWhy do you think it helps anything at all?\n\nWe have a _length_ of buffer. We don't have any zero-termination.\n\n\t\tLinus\n"},{"id":"2710","messageId":"427BE5F4.3040602@zytor.com","threadId":"508","inReplyTo":"7vbr7ocfj7.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Tweak git-diff-tree -v output further (take 2).","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2005-05-06T21:47:32Z","receivedAt":"2005-05-06T21:47:32Z","isPatch":true,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"Junio C Hamano wrote:\n> (This one is simpler than the previous one I just sent out)\n> \n> The first hunk of this is a pure bugfix---it guards us against a\n> commit message that does not end with a newline.\n\nNo it doesn't.  What it does is \"guard\" you against a commit message \nwhich contains a null character.  What's not entirely clear is if that's \nwhat you wanted to do.\n\n\t-hpa\n"},{"id":"2713","messageId":"7v4qdgc8o5.fsf@assigned-by-dhcp.cox.net","threadId":"508","inReplyTo":"Pine.LNX.4.58.0505061440180.2233@ppc970.osdl.org","subject":"Re: [PATCH] Tweak git-diff-tree -v output further (take 2).","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-06T22:05:14Z","receivedAt":"2005-05-06T22:05:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"You are absolutely right.\n\n"}]}