Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 4/5] archive-tar: stream large blobs to tar file

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:41

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted hunk
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 archive-tar.c    |   38 +++++++++++++++++++++++++++++++++++---
 t/t1050-large.sh |    4 ++++
 2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/archive-tar.c b/archive-tar.c
index 61821f4..865ef6d 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -4,6 +4,7 @@
 #include "cache.h"
 #include "tar.h"
 #include "archive.h"
+#include "streaming.h"
 #include "run-command.h"
 
 #define RECORDSIZE	(512)
@@ -62,6 +63,29 @@ static void write_blocked(const void *data, unsigned long size)
 	write_if_needed();
 }
 
+static int stream_blob_to_file(const unsigned char *sha1)
The name of this function is misleading and caused me to look for an
existing implementation that streams blob contents to a given fd while
wondering how that fd is passed to this function.

I do not think it would make sense to reuse stream_blob_to_fd() here, as
is it too much hassle to account for blocking factors.  In order to make
it clear for future futzers that this is not something they can turn into
global function and reuse outside the context of generating tar archive
output, please rename it either to stream_blob_to_tarfile(), which is more
specific, or stream_blocked(), which is too vague and nobody sane would
think about exporting from the file just like existing write_blocked() is.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help