{"thread":{"id":"838","subject":"[PATCH] Improve git-rev-list --header output","startedAt":"2005-06-05T13:25:16Z","lastAt":"2005-06-05T15:17:44Z","messageCount":2,"participants":["Petr Baudis","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4571","messageId":"20050605132515.GB17462@pasky.ji.cz","threadId":"838","inReplyTo":null,"subject":"[PATCH] Improve git-rev-list --header output","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-05T13:25:16Z","receivedAt":"2005-06-05T13:25:16Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Indent the commit header by four spaces like in the --pretty output;\nthe commit ID is still shown unaligned. This makes the --header output\nactually usable for further processing.\n\nSigned-off-by: Petr Baudis <pasky@ucw.cz>\n\n---\ncommit 7c99469f9820f41138e1bfe1a0f416fa6b56d09d\ntree ea9091df859f279e920ec0f8ca9fdc8d9d307e33\nparent 441258d08a4bc12121c998e0aa112c8453eb15fc\nauthor Petr Baudis <pasky@ucw.cz> Sun, 05 Jun 2005 15:24:25 +0200\ncommitter Petr Baudis <xpasky@machine.sinus.cz> Sun, 05 Jun 2005 15:24:25 +0200\n\n rev-list.c |   26 ++++++++++++++++++++++++--\n 1 files changed, 24 insertions(+), 2 deletions(-)\n\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -35,12 +35,34 @@ static void show_commit(struct commit *c\n \tputchar('\\n');\n \tif (verbose_header) {\n \t\tconst char *buf = commit->buffer;\n+\t\tstatic char pretty_header[16384];\n \t\tif (pretty_print) {\n-\t\t\tstatic char pretty_header[16384];\n \t\t\tpretty_print_commit(commit->buffer, ~0, pretty_header, sizeof(pretty_header));\n \t\t\tbuf = pretty_header;\n+\t\t} else {\n+\t\t\t/* Indent the commit contents by four chars */\n+\t\t\tchar *buf2 = pretty_header;\n+\t\t\tchar *eol;\n+\t\t\tdo {\n+\t\t\t\tint len = -1;\n+\n+\t\t\t\teol = strchr(buf, '\\n');\n+\t\t\t\tif (eol || *buf) {\n+\t\t\t\t\tstrcpy(buf2, \"    \");\n+\t\t\t\t\tbuf2 += 4;\n+\t\t\t\t}\n+\t\t\t\tif (eol) {\n+\t\t\t\t\teol++;\n+\t\t\t\t\tlen = eol - buf;\n+\t\t\t\t\tstrncpy(buf2, buf, len);\n+\t\t\t\t\tbuf2 += len;\n+\t\t\t\t\tbuf = eol;\n+\t\t\t\t} else {\n+\t\t\t\t\tstrcpy(buf2, buf);\n+\t\t\t\t}\n+\t\t\t} while (eol);\n \t\t}\n-\t\tprintf(\"%s%c\", buf, hdr_termination);\n+\t\tprintf(\"%s%c\", pretty_header, hdr_termination);\n \t}\n }\n \n\n|\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4574","messageId":"Pine.LNX.4.58.0506050815130.1876@ppc970.osdl.org","threadId":"838","inReplyTo":"20050605132515.GB17462@pasky.ji.cz","subject":"Re: [PATCH] Improve git-rev-list --header output","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-05T15:17:44Z","receivedAt":"2005-06-05T15:17:44Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 5 Jun 2005, Petr Baudis wrote:\n>\n> Indent the commit header by four spaces like in the --pretty output;\n> the commit ID is still shown unaligned. This makes the --header output\n> actually usable for further processing.\n\nI'm actually going to do a few different \"header formats\", and have \npretty_print_commit() able to switch between them. IOW, this would count \nas just one form of pretty-printing.\n\nI want to have the \"dense\" format, which has only the author and the top\nline(s) of the description (stop at the first empty line), and a \"raw\"  \nformat, which has all the parent information etc (ie this one).\n\n\t\tLinus\n"}]}