author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Wed, 7 Mar 2012 10:54:18 +0000 (17:54 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 7 Mar 2012 17:07:38 +0000 (09:07 -0800) | ||
commit | 090ea12671b2971b1c613f0a3d2657e8cdd35134 | |
tree | f5a3fdf42e7baf22513bf7700de6693a4b4fe651 | tree | snapshot |
parent | 00c8fd493afbd1620febf2b895fb2365f76d5875 | commit | diff |
parse_object: avoid putting whole blob in core
Traditionally, all the callers of check_sha1_signature() first
called read_sha1_file() to prepare the whole object data in core,
and called this function. The function is used to revalidate what
we read from the object database actually matches the object name we
used to ask for the data from the object database.
Update the API to allow callers to pass NULL as the object data, and
have the function read and hash the object data using streaming API
to recompute the object name, without having to hold everything in
core at the same time. This is most useful in parse_object() that
parses a blob object, because this caller does not have to keep the
actual blob data around in memory after a "struct blob" is returned.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Traditionally, all the callers of check_sha1_signature() first
called read_sha1_file() to prepare the whole object data in core,
and called this function. The function is used to revalidate what
we read from the object database actually matches the object name we
used to ask for the data from the object database.
Update the API to allow callers to pass NULL as the object data, and
have the function read and hash the object data using streaming API
to recompute the object name, without having to hold everything in
core at the same time. This is most useful in parse_object() that
parses a blob object, because this caller does not have to keep the
actual blob data around in memory after a "struct blob" is returned.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object.c | diff | blob | history | |
sha1_file.c | diff | blob | history |