{"thread":{"id":"16340","subject":"Fix machine-parseability of 'git log --source'","startedAt":"2008-11-15T18:02:01Z","lastAt":"2008-11-15T18:02:01Z","messageCount":1,"participants":["Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"95894","messageId":"alpine.LFD.2.00.0811150947430.3468@nehalem.linux-foundation.org","threadId":"16340","inReplyTo":null,"subject":"Fix machine-parseability of 'git log --source'","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-11-15T18:02:01Z","receivedAt":"2008-11-15T18:02:01Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nThe space between the commit and the source attribute is not easily \nmachine-parseable: if we combine --source with --parents and give a SHA1 \nas a starting point, it's unnecessarily hard to see where the list of \nparents ends and the source decoration begins.\n\nExample:\n\tgit show --parents --source $(git rev-list HEAD)\n\nwhich is admittedly contrived, but can easily happen in scripting.\n\nSo use a <tab> instead of a space as the source separator.\n\nThe other decorations didn't have this issue, because they were surrounded \nby parenthesis, so it's obvious that they aren't parent SHA1's.\n\nIt so happens that _visually_ this makes no difference for \"git log \n--source\", since \"commit <40-char SHA1>\" is 47 characters, so both a space \nand a <tab> will end up showing as a single commit. Of course, with \n'--pretty=oneline' or '--parents' or '--abbrev-commit' you'll see the \ndifference.\n\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n---\n\nThis is all partly because I also wish that 'gitk' would use --decorate to \ngive decorations rather than look them up by hand. I'm not entirely source \n--source is useful for gitk (since it wants _all_ branches), but I do know \nthat I hate knowing that\n\n\tgitk --source\n\njust results in parse errors.\n\n log-tree.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 5444f08..194ddb1 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -58,7 +58,7 @@ void show_decorations(struct rev_info *opt, struct commit *commit)\n \tstruct name_decoration *decoration;\n \n \tif (opt->show_source && commit->util)\n-\t\tprintf(\" %s\", (char *) commit->util);\n+\t\tprintf(\"\\t%s\", (char *) commit->util);\n \tif (!opt->show_decorations)\n \t\treturn;\n \tdecoration = lookup_decoration(&name_decoration, &commit->object);\n"}]}