summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-07-29 18:17:37 -0700
committerJunio C Hamano <gitster@pobox.com>2024-07-29 18:19:14 -0700
commit3f288b6fafbb8c76edf53fba7cea90d5a20a9c56 (patch)
treedb55252ef8839be609eae2c50603477863efce25 /commit.c
parent2438294a13dc3f04684bcfb1af75008b3ca07f86 (diff)
patch-id: rewrite code that detects the beginning of a patch
The get_one_patchid() function reads input lines until it finds a patch header (the line that begins a patch), whose beginning is one of: (1) an "<object name>", which is what "git diff-tree --stdin" shows; (2) "commit <object name>", which is what "git log" shows; or (3) "From <object name>", which is what "git log --format=email" shows. When it finds such a line, it returns to the caller, reporting the <object name> it found, and the size of the "patch" it processed. The caller then calls the function again, which then ignores the commit log message, and then processes the lines in the patch part until it hits another "beginning of a patch". The above logic was fairly easy to see until 2bb73ae8 (patch-id: use starts_with() and skip_prefix(), 2016-05-28) reorganized the code, which made another logic that has nothing to do with the "where does the next patch begin?" logic, which came from 2485eab5 (git-patch-id: do not trip over "no newline" markers, 2011-02-17) that ignores the "\ No newline at the end", rolled into the same single if() statement. Let's split it out. The "\ No newline at the end" marker is part of the patch, should not appear before we start reading the patch part, and does not belong to the detection of patch header. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions