diff options
author | Han Xin <hanxin.hx@alibaba-inc.com> | 2022-06-11 10:44:17 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-13 10:22:35 -0700 |
commit | 97a9db6ffb13a49dfe0565b65275b935f4e4d620 (patch) | |
tree | 8b8f08c409863bc7ca991b0e7b4f5cfa7ef7f827 /t/t9133-git-svn-nested-git-repo.sh | |
parent | a1bf5ca29f7ebb41e24318147518fc7c738303e5 (diff) |
object-file.c: refactor write_loose_object() to several steps
When writing a large blob using "write_loose_object()", we have to pass
a buffer with the whole content of the blob, and this behavior will
consume lots of memory and may cause OOM. We will introduce a stream
version function ("stream_loose_object()") in later commit to resolve
this issue.
Before introducing that streaming function, do some refactoring on
"write_loose_object()" to reuse code for both versions.
Rewrite "write_loose_object()" as follows:
1. Figure out a path for the (temp) object file. This step is only
used in "write_loose_object()".
2. Move common steps for starting to write loose objects into a new
function "start_loose_object_common()".
3. Compress data.
4. Move common steps for ending zlib stream into a new function
"end_loose_object_common()".
5. Close fd and finalize the object file.
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Han Xin <chiyutianyi@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9133-git-svn-nested-git-repo.sh')
0 files changed, 0 insertions, 0 deletions