From: Han Xin <redacted>
We will use "write_object_file_flags()" in "unpack_non_delta_entry()" to
read the entire data contents in stream. When read in stream, we needn't
prepare "oid" before "write_loose_object()", only generate the header.
Signed-off-by: Han Xin <redacted>
---
object-file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/object-file.c b/object-file.c
index 455ab3c06e..906590dae5 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2002,6 +2002,11 @@ int write_object_file_flags(const void *buf, unsigned long len,
{
char hdr[MAX_HEADER_LEN];
int hdrlen = sizeof(hdr);
+ if (flags & HASH_STREAM) {
+ /* Generate the header */
+ hdrlen = xsnprintf(hdr, hdrlen, "%s %"PRIuMAX , type, (uintmax_t)len)+1;
+ return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
+ }
/* Normally if we have it in the pack then we do not bother writing
* it out into .git/objects/??/?{38} file.--
2.34.0