sequencer: export and rename subject_length()
This function can be used in other parts of git. Let's move the function to commit.c and also rename it to make the name of the function more generic. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Charvi Mendiratta <charvi077@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fa153c1cd7
commit
6e0e288779
14
commit.c
14
commit.c
@ -535,6 +535,20 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
|
||||
return eol - p;
|
||||
}
|
||||
|
||||
size_t commit_subject_length(const char *body)
|
||||
{
|
||||
const char *p = body;
|
||||
while (*p) {
|
||||
const char *next = skip_blank_lines(p);
|
||||
if (next != p)
|
||||
break;
|
||||
p = strchrnul(p, '\n');
|
||||
if (*p)
|
||||
p++;
|
||||
}
|
||||
return p - body;
|
||||
}
|
||||
|
||||
struct commit_list *commit_list_insert(struct commit *item, struct commit_list **list_p)
|
||||
{
|
||||
struct commit_list *new_list = xmalloc(sizeof(struct commit_list));
|
||||
|
Reference in New Issue
Block a user