]> git.ipfire.org Git - thirdparty/git.git/commit
receive-pack.c: consolidate find header logic
authorJohn Cai <johncai86@gmail.com>
Thu, 6 Jan 2022 20:07:35 +0000 (20:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Jan 2022 21:17:20 +0000 (13:17 -0800)
commitcfc5cf428bcc8ff31748bba97baee31f529a30ea
tree46198b3f3106a8bc3e631bb3da928341df7b259b
parent2ae0a9cb8298185a94e5998086f380a355dd8907
receive-pack.c: consolidate find header logic

There are two functions that have very similar logic of finding a header
value. find_commit_header, and find_header. We can conslidate the logic
by introducing a new function find_header_mem, which is equivalent to
find_commit_header except it takes a len parameter that determines how
many bytes will be read. find_commit_header and find_header can then both
call find_header_mem.

This reduces duplicate logic, as the logic for finding header values
can now all live in one place.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
commit.c
commit.h