diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-07-29 18:17:38 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-29 18:19:14 -0700 |
commit | a6e9429f728d088999b815c25adbd2f2c115e051 (patch) | |
tree | 4e12dc17b4ff72055a12152a9c041b3ff6a9f4c8 /commit.c | |
parent | 3f288b6fafbb8c76edf53fba7cea90d5a20a9c56 (diff) |
patch-id: tighten code to detect the patch header
The get_one_patchid() function unconditionally takes a line that
matches the patch header (namely, a line that begins with a full
object name, possibly prefixed by "commit" or "From" plus a space)
as the beginning of a patch. Even when it is *not* looking for one
(namely, when the previous call found the patch header and returned,
and then we are called again to skip the log message and process the
patch whose header was found by the previous invocation).
As a consequence, a line in the commit log message that begins with
one of these patterns can be mistaken to start another patch, with
current message entirely skipped (because we haven't even reached
the patch at all).
Allow the caller to tell us if it called us already and saw the
patch header (in which case we shouldn't be looking for another one,
until we see the "diff" part of the patch; instead we simply should
be skipping these lines as part of the commit log message), and skip
the header processing logic when that is the case. In the helper
function, it also needs to flip this "are we looking for a header?"
bit, once it finished skipping the commit log message and started
processing the patches, as the patch header of the _next_ message is
the only clue in the input that the current patch is done.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions