summaryrefslogtreecommitdiff
path: root/trailer.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'cc/trailers-corner-case-fix'Junio C Hamano2015-09-021-4/+11
|\ | | | | | | | | | | | | | | | | The "interpret-trailers" helper mistook a multi-paragraph title of a commit log message with a colon in it as the end of the trailer block. * cc/trailers-corner-case-fix: trailer: support multiline title
| * trailer: support multiline titlecc/trailers-corner-case-fixChristian Couder2015-08-311-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently ignore the first line passed to `git interpret-trailers`, when looking for the beginning of the trailers. Unfortunately this does not work well when a commit is created with a line break in the title, using for example the following command: git commit -m 'place of code: change we made' That's why instead of ignoring only the first line, it is better to ignore the first paragraph. Signed-off-by: Christian Couder <christian.couder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cc/trailers-corner-case-fix'Junio C Hamano2015-08-281-1/+3
|\ \ | |/ | | | | | | | | | | | | | | "interpret-trailers" helper mistook a single-liner log message that has a colon as the end of existing trailer. * cc/trailers-corner-case-fix: trailer: retitle a test and correct an in-comment message trailer: ignore first line of message
| * trailer: retitle a test and correct an in-comment messageChristian Couder2015-08-261-1/+2
| | | | | | | | | | Signed-off-by: Christian Couder <christian.couder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * trailer: ignore first line of messageChristian Couder2015-08-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When looking for the start of the trailers in the message we are passed, we should ignore the first line of the message. The reason is that if we are passed a patch or commit message then the first line should be the patch title. If we are passed only trailers we can expect that they start with an empty line that can be ignored too. This way we can properly process commit messages that have only one line with something that looks like a trailer, for example like "area of code: change we made". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | trailer: use capture_commandJeff King2015-03-221-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we read from a trailer.*.command sub-program, the current code uses run_command followed by a pipe read, which can result in deadlock (though in practice you would have to have a large trailer for this to be a problem). The current code also leaks the file descriptor for the pipe to the sub-command. Instead, let's use capture_command, which makes this simpler (and we can get rid of our custom helper). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | do not include the same header twicedp/remove-duplicated-header-inclusionДилян Палаузов2015-02-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | A few files include the same header file directly more than once. As all these headers protect themselves against repeated inclusion by the "#ifndef FOO_H / #define FOO_H / ... / #endif" idiom, leave only the first inclusion and remove the later inclusion as a no-op clean-up. Signed-off-by: Дилян Палаузов <git-dpa@aegee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cc/interpret-trailers-more'Junio C Hamano2014-12-221-7/+25
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | "git interpret-trailers" learned to properly handle the "Conflicts:" block at the end. * cc/interpret-trailers-more: trailer: add test with an old style conflict block trailer: reuse ignore_non_trailer() to ignore conflict lines commit: make ignore_non_trailer() non static merge & sequencer: turn "Conflicts:" hint into a comment builtin/commit.c: extract ignore_non_trailer() helper function merge & sequencer: unify codepaths that write "Conflicts:" hint builtin/merge.c: drop a parameter that is never used
| * trailer: reuse ignore_non_trailer() to ignore conflict linesChristian Couder2014-11-101-7/+25
| | | | | | | | | | | | | | | | Make sure we look for trailers before any conflict line by reusing the ignore_non_trailer() function. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cc/interpret-trailers'Junio C Hamano2014-11-191-4/+10
|\ \ | |/ | | | | | | | | | | | | Small fixes to a new experimental command already in 'master'. * cc/interpret-trailers: trailer: display a trailer without its trailing newline trailer: ignore comment lines inside the trailers
| * trailer: display a trailer without its trailing newlinecc/interpret-trailersChristian Couder2014-11-101-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | Trailers passed to the parse_trailer() function often have a trailing newline. When erroring out, we should display the invalid trailer properly, that means without any trailing newline. Helped-by: Junio C Hamano <gitster@pobox.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * trailer: ignore comment lines inside the trailersChristian Couder2014-11-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise trailers that are commented out might be processed. We would also error out if the comment line char is also a separator. This means that comments inside a trailer block will disappear, but that was already the case anyway. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | trailer: use CHILD_PROCESS_INIT in apply_command()René Scharfe2014-11-101-2/+1
| | | | | | | | | | | | | | | | | | | | Initialize the struct child_process variable cp at declaration time. This is shorter, saves a function call and prevents using the variable before initialization by mistake. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | use child_process_init() to initialize struct child_process variablesRené Scharfe2014-10-281-1/+1
|/ | | | | | | | | Call child_process_init() instead of zeroing the memory of variables of type struct child_process by hand before use because the former is both clearer and shorter. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: execute command from 'trailer.<name>.command'Christian Couder2014-10-131-1/+84
| | | | | | | | Let the user specify a command that will give on its standard output the value to use for the specified trailer. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: put all the processing together and printChristian Couder2014-10-131-0/+69
| | | | | | | | | This patch adds the process_trailers() function that calls all the previously added processing functions and then prints the results on the standard output. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: parse trailers from file or stdinChristian Couder2014-10-131-0/+123
| | | | | | | | Read trailers from a file or from stdin, parse the trailers and then put the result into a doubly linked list. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: process command line trailer argumentsChristian Couder2014-10-131-0/+112
| | | | | | | | Parse the trailer command line arguments and put the result into an arg_tok doubly linked list. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: read and process config informationChristian Couder2014-10-131-0/+185
| | | | | | | | | | | | | Read the configuration to get trailer information, and then process it and store it in a doubly linked list. The config information is stored in the list whose first item is pointed to by: static struct trailer_item *first_conf_item; Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: process trailers from input message and argumentsChristian Couder2014-10-131-0/+210
| | | | | | | | | | | | | | | Implement the logic to process trailers from the input message and from arguments. At the beginning trailers from the input message are in their own "in_tok" doubly linked list, and trailers from arguments are in their own "arg_tok" doubly linked list. The lists are traversed and when an "arg_tok" should be "applied", it is removed from its list and inserted into the "in_tok" list. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* trailer: add data structures and basic functionsChristian Couder2014-10-131-0/+69
We will use a doubly linked list to store all information about trailers and their configuration. This way we can easily remove or add trailers to or from trailer lists while traversing the lists in either direction. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>