{"thread":{"id":"36084","subject":"[PATCH v7 00/11] Add interpret-trailers builtin","startedAt":"2014-03-06T22:06:18Z","lastAt":"2014-03-10T15:27:02Z","messageCount":4,"participants":["Christian Couder","Junio C Hamano","Øystein Walle"],"isPatch":true,"patchVersion":7,"patchTotal":11},"messages":[{"id":"236236","messageId":"20140306220029.29150.64594.chriscool@tuxfamily.org","threadId":"36084","inReplyTo":null,"subject":"[PATCH v7 00/11] Add interpret-trailers builtin","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2014-03-06T22:06:18Z","receivedAt":"2014-03-06T22:06:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This patch series implements a new command:\n\n        git interpret-trailers\n\nand an infrastructure to process trailers that can be reused,\nfor example in \"commit.c\".\n\n1) Rationale:\n\nThis command should help with RFC 822 style headers, called\n\"trailers\", that are found at the end of commit messages.\n\n(Note that these headers do not follow and are not intended to\nfollow many rules that are in RFC 822. For example they do not\nfollow the line breaking rules, the encoding rules and probably\nmany other rules.)\n\nFor a long time, these trailers have become a de facto standard\nway to add helpful information into commit messages.\n\nUntil now git commit has only supported the well known\n\"Signed-off-by: \" trailer, that is used by many projects like\nthe Linux kernel and Git.\n\nIt is better to implement features for these trailers first in a\nnew command rather than in builtin/commit.c, because this way the\nprepare-commit-msg and commit-msg hooks can reuse this command.\n\n2) Current state:\n\nCurrently the usage string of this command is:\n\ngit interpret-trailers [--trim-empty] [(<token>[(=|:)<value>])...]\n\nThe following features are implemented:\n\n        - the result is printed on stdout\n        - the [<token>[=<value>]>] arguments are interpreted\n        - a commit message read from stdin is interpreted\n        - the \"trailer.<token>.key\" options in the config are interpreted\n        - the \"trailer.<token>.where\" options are interpreted\n        - the \"trailer.<token>.ifExist\" options are interpreted\n        - the \"trailer.<token>.ifMissing\" options are interpreted\n        - the \"trailer.<token>.command\" config works\n        - $ARG can be used in commands\n        - there are some tests\n        - there is some documentation\n\nThe following features are planned but not yet implemented:\n        - add more tests related to commands\n        - add examples in documentation\n        - integration with \"git commit\"\n\nPossible improvements:\n        - support GIT_COMMIT_PROTO env variable in commands\n\n3) Changes since version 6, thanks to Junio and Ramsey:\n\n* many style fixes\n* clearer and nicer setup tests\n* trailer.h is included at the beginning of trailer.c\n\n\nChristian Couder (11):\n  Add data structures and basic functions for commit trailers\n  trailer: process trailers from stdin and arguments\n  trailer: read and process config information\n  trailer: process command line trailer arguments\n  trailer: parse trailers from stdin\n  trailer: put all the processing together and print\n  trailer: add interpret-trailers command\n  trailer: add tests for \"git interpret-trailers\"\n  trailer: execute command from 'trailer.<name>.command'\n  trailer: add tests for commands in config file\n  Documentation: add documentation for 'git interpret-trailers'\n\n .gitignore                               |   1 +\n Documentation/git-interpret-trailers.txt | 123 ++++++\n Makefile                                 |   2 +\n builtin.h                                |   1 +\n builtin/interpret-trailers.c             |  33 ++\n git.c                                    |   1 +\n t/t7513-interpret-trailers.sh            | 261 ++++++++++++\n trailer.c                                | 667 +++++++++++++++++++++++++++++++\n trailer.h                                |   6 +\n 9 files changed, 1095 insertions(+)\n create mode 100644 Documentation/git-interpret-trailers.txt\n create mode 100644 builtin/interpret-trailers.c\n create mode 100755 t/t7513-interpret-trailers.sh\n create mode 100644 trailer.c\n create mode 100644 trailer.h\n\n-- \n1.8.5.2.204.gcfe299d.dirty\n"},{"id":"236277","messageId":"xmqq8uslu1bi.fsf@gitster.dls.corp.google.com","threadId":"36084","inReplyTo":"20140306220029.29150.64594.chriscool@tuxfamily.org","subject":"Re: [PATCH v7 00/11] Add interpret-trailers builtin","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-07T21:49:05Z","receivedAt":"2014-03-07T21:49:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> * many style fixes\n\nThis round is readable ;-)  Thanks.\n\n> * clearer and nicer setup tests\n\nThose long lines that use \"printf\" with many embedded \\n were harder\nto read and also looked harder to maintain if we ever wanted to\nchange them.  Splicing a string with \\n in the middle of a long\nsingle line is far harder than adding an independent line, I would\nthink.  For example:\n\n\t... &&\n\tprintf \"Fixes: \\nAcked-by= \\nReviewed-by: \\nSigned-off-by: \\n\" >>expected &&\n\t...\n\nis easier to read and maintain if written like so (with using HT\nproperly---our MUAs may damage it and turn the indentation into\nspaces):\n\n\t... &&\n\tsed -e \"s/ Z$/ /\" >>expect <<-\\EOF &&\n        Fixes: Z\n        Acked-by= Z\n        Reviewed-by: Z\n        Signed-off-by: Z\n\tEOF\n\t...\n"},{"id":"236319","messageId":"loom.20140308T124447-78@post.gmane.org","threadId":"36084","inReplyTo":"xmqq8uslu1bi.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v7 00/11] Add interpret-trailers builtin","fromName":"Øystein Walle","fromEmail":"oystwa@gmail.com","sentAt":"2014-03-08T11:54:14Z","receivedAt":"2014-03-08T11:54:14Z","isPatch":true,"sender":{"key":"oystwa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/794585?v=4"},"body":"Junio C Hamano <gitster <at> pobox.com> writes:\n\n> \n> \t...\n> \n> is easier to read and maintain if written like so (with using HT\n> properly---our MUAs may damage it and turn the indentation into\n> spaces):\n> \n> \t... &&\n> \tsed -e \"s/ Z$/ /\" >>expect <<-\\EOF &&\n>         Fixes: Z\n>         Acked-by= Z\n>         Reviewed-by: Z\n>         Signed-off-by: Z\n> \tEOF\n> \t...\n> \n\nHow about:\n\n   printf '%s: \\n' Fixes Acked-by Reviewed-by Signed-off-by >> expect\n\nThis solution scores high marks in both readability and maintainability\nin my mind.\n"},{"id":"236410","messageId":"xmqqa9cyrs55.fsf@gitster.dls.corp.google.com","threadId":"36084","inReplyTo":"loom.20140308T124447-78@post.gmane.org","subject":"Re: [PATCH v7 00/11] Add interpret-trailers builtin","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-10T15:27:02Z","receivedAt":"2014-03-10T15:27:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Øystein Walle <oystwa@gmail.com> writes:\n\n> Junio C Hamano <gitster <at> pobox.com> writes:\n>\n>> \n>> \t...\n>> \n>> is easier to read and maintain if written like so (with using HT\n>> properly---our MUAs may damage it and turn the indentation into\n>> spaces):\n>> \n>> \t... &&\n>> \tsed -e \"s/ Z$/ /\" >>expect <<-\\EOF &&\n>>         Fixes: Z\n>>         Acked-by= Z\n>>         Reviewed-by: Z\n>>         Signed-off-by: Z\n>> \tEOF\n>> \t...\n>> \n>\n> How about:\n>\n>    printf '%s: \\n' Fixes Acked-by Reviewed-by Signed-off-by >> expect\n\nNot really.\n\n> This solution scores high marks in both readability and maintainability\n> in my mind.\n\nI actually considered that approach while I was writing the message\nyou responded to, but discarded it because it forces us to commit to\nthe view that we forsee no need to test an output that does not end\nwith a trailing whitespace.  And I do not think that is a limitation\nwe want to place on this test.\n"}]}