]> git.ipfire.org Git - thirdparty/git.git/commit - trailer.c
trailer: clarify failure modes in parse_trailer
authorJonathan Tan <jonathantanmy@google.com>
Fri, 21 Oct 2016 17:55:00 +0000 (10:55 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Oct 2016 18:48:35 +0000 (11:48 -0700)
commitfdbf4510aeb7e7b860c2ee77b8a4a3c5787fe182
tree63871e670950f601b23c73aafcb3ca259583b67a
parentcc71b0de115808835486bc10d094b49261128276
trailer: clarify failure modes in parse_trailer

The parse_trailer function has a few modes of operation, all depending
on whether the separator is present in its input, and if yes, the
separator's position. Some of these modes are failure modes, and these
failure modes are handled differently depending on whether the trailer
line was sourced from a file or from a command-line argument.

Extract a function to find the separator, allowing the invokers of
parse_trailer to determine how to handle the failure modes instead of
making parse_trailer do it. In this function, also take in the list of
separators, so that we can distinguish between command line arguments
(which allow '=' as separator) and file input (which does not allow '='
as separator).

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
trailer.c