]> Kevux Git Server - rit/commit
object: factor out parse_mode out of fast-import and tree-walk into in object.h
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 2 Oct 2023 02:40:18 +0000 (21:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Oct 2023 21:57:39 +0000 (14:57 -0700)
commit45b3b1214154975ac03c818838e3d12571f57d1e
treead173a49d3e0fce5ce3e81ce0801bfe3c24e1f7e
parent095261a18d91cf47e8e8ef3b55f5e88e52ffc85f
object: factor out parse_mode out of fast-import and tree-walk into in object.h

builtin/fast-import.c and tree-walk.c have almost identical version of
get_mode.  The two functions started out the same but have diverged
slightly.  The version in fast-import changed mode to a uint16_t to
save memory.  The version in tree-walk started erroring if no mode was
present.

As far as I can tell both of these changes are valid for both of the
callers, so add the both changes and place the common parsing helper
in object.h

Rename the helper from get_mode to parse_mode so it does not
conflict with another helper named get_mode in diff-no-index.c

This will be used shortly in a new helper decode_tree_entry_raw
which is used to compute cmpatibility objects as part of
the sha256 transition.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-import.c
object.h
tree-walk.c