streaming: convert open_istream to use struct object_id
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Mar 12, 2018 at 02:27 UTC
ef7b5195f1ee8ceef41fb2f03a46248ad7747d69
7 files changed
+9
-9
archive-tar.c
+1
-1
@@ -119,7 +119,7 @@ static int stream_blocked(const struct object_id *oid)
119
char buf[BLOCKSIZE];
120
ssize_t readlen;
121
122
- st = open_istream(oid->hash, &type, &sz, NULL);
122
+ st = open_istream(oid, &type, &sz, NULL);
123
if (!st)
124
return error("cannot stream blob %s", oid_to_hex(oid));
125
for (;;) {
archive-zip.c
+1
-1
@@ -337,7 +337,7 @@ static int write_zip_entry(struct archiver_args *args,
337
338
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
339
size > big_file_threshold) {
340
- stream = open_istream(oid->hash, &type, &size, NULL);
340
+ stream = open_istream(oid, &type, &size, NULL);
341
if (!stream)
342
return error("cannot stream blob %s",
343
oid_to_hex(oid));
builtin/index-pack.c
+1
-1
@@ -771,7 +771,7 @@ static int check_collison(struct object_entry *entry)
771
772
memset(&data, 0, sizeof(data));
773
data.entry = entry;
774
- data.st = open_istream(entry->idx.oid.hash, &type, &size, NULL);
774
+ data.st = open_istream(&entry->idx.oid, &type, &size, NULL);
775
if (!data.st)
776
return -1;
777
if (size != entry->size || type != entry->type)
builtin/pack-objects.c
+1
-1
@@ -267,7 +267,7 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
267
if (!usable_delta) {
268
if (entry->type == OBJ_BLOB &&
269
entry->size > big_file_threshold &&
270
- (st = open_istream(entry->idx.oid.hash, &type, &size, NULL)) != NULL)
270
+ (st = open_istream(&entry->idx.oid, &type, &size, NULL)) != NULL)
271
buf = NULL;
272
else {
273
buf = read_sha1_file(entry->idx.oid.hash, &type,
sha1_file.c
+1
-1
@@ -799,7 +799,7 @@ int check_object_signature(const struct object_id *oid, void *map,
799
return oidcmp(oid, &real_oid) ? -1 : 0;
800
}
801
802
- st = open_istream(oid->hash, &obj_type, &size, NULL);
802
+ st = open_istream(oid, &obj_type, &size, NULL);
803
if (!st)
804
return -1;
805
streaming.c
+3
-3
@@ -130,14 +130,14 @@ static enum input_source istream_source(const unsigned char *sha1,
130
}
131
}
132
133
-struct git_istream *open_istream(const unsigned char *sha1,
133
+struct git_istream *open_istream(const struct object_id *oid,
134
enum object_type *type,
135
unsigned long *size,
136
struct stream_filter *filter)
137
{
138
struct git_istream *st;
139
struct object_info oi = OBJECT_INFO_INIT;
140
- const unsigned char *real = lookup_replace_object(sha1);
140
+ const unsigned char *real = lookup_replace_object(oid->hash);
141
enum input_source src = istream_source(real, type, &oi);
142
143
if (src < 0)
@@ -507,7 +507,7 @@ int stream_blob_to_fd(int fd, const struct object_id *oid, struct stream_filter
507
ssize_t kept = 0;
508
int result = -1;
509
510
- st = open_istream(oid->hash, &type, &sz, filter);
510
+ st = open_istream(oid, &type, &sz, filter);
511
if (!st) {
512
if (filter)
513
free_stream_filter(filter);
streaming.h
+1
-1
@@ -8,7 +8,7 @@
8
/* opaque */
9
struct git_istream;
10
11
-extern struct git_istream *open_istream(const unsigned char *, enum object_type *, unsigned long *, struct stream_filter *);
11
+extern struct git_istream *open_istream(const struct object_id *, enum object_type *, unsigned long *, struct stream_filter *);
12
extern int close_istream(struct git_istream *);
13
extern ssize_t read_istream(struct git_istream *, void *, size_t);
14