aboutsummaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-15 22:50:38 -0700
committerJunio C Hamano <gitster@pobox.com>2012-04-15 22:50:39 -0700
commit47de6b0425c79081e64756dcc019bb26344bf7ad (patch)
tree74179a74db058b14979c3e7a5a5fc97b97965ce6 /builtin/fsck.c
parent30fd3a54256a54e5a6006a203c923e97641fb2c2 (diff)
parentda591a7f4bbe1a208cc5f955523506eb857c45ca (diff)
downloadgit-47de6b0425c79081e64756dcc019bb26344bf7ad.tar.gz
git-47de6b0425c79081e64756dcc019bb26344bf7ad.tar.xz
Merge branch 'nd/stream-more'
Use API to read blob data in smaller chunks in more places to reduce the memory footprint. By Nguyễn Thái Ngọc Duy (6) and Junio C Hamano (1) * nd/stream-more: update-server-info: respect core.bigfilethreshold fsck: use streaming API for writing lost-found blobs show: use streaming API for showing blobs parse_object: avoid putting whole blob in core cat-file: use streaming API to print blobs Add more large blob test cases streaming: make streaming-write-entry to be more reusable
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 67eb553c7..a710227a6 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -12,6 +12,7 @@
#include "parse-options.h"
#include "dir.h"
#include "progress.h"
+#include "streaming.h"
#define REACHABLE 0x0001
#define SEEN 0x0002
@@ -238,13 +239,8 @@ static void check_unreachable_object(struct object *obj)
if (!(f = fopen(filename, "w")))
die_errno("Could not open '%s'", filename);
if (obj->type == OBJ_BLOB) {
- enum object_type type;
- unsigned long size;
- char *buf = read_sha1_file(obj->sha1,
- &type, &size);
- if (buf && fwrite(buf, 1, size, f) != size)
+ if (stream_blob_to_fd(fileno(f), obj->sha1, NULL, 1))
die_errno("Could not write '%s'", filename);
- free(buf);
} else
fprintf(f, "%s\n", sha1_to_hex(obj->sha1));
if (fclose(f))