Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 837d395

Browse files
iabervongitster
authored andcommitted
Replace parse_blob() with an explanatory comment
parse_blob() has never actually been used; it has served simply to avoid having a confusing gap in the API. Instead of leaving it, put in a comment that explains what "parsing a blob" entails (making sure the object is actually readable), and why code might care whether a blob has been parsed or not. Signed-off-by: Daniel Barkalow <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 64161a6 commit 837d395

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

blob.c

-21
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,3 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
2323
item->object.parsed = 1;
2424
return 0;
2525
}
26-
27-
int parse_blob(struct blob *item)
28-
{
29-
enum object_type type;
30-
void *buffer;
31-
unsigned long size;
32-
int ret;
33-
34-
if (item->object.parsed)
35-
return 0;
36-
buffer = read_sha1_file(item->object.sha1, &type, &size);
37-
if (!buffer)
38-
return error("Could not read %s",
39-
sha1_to_hex(item->object.sha1));
40-
if (type != OBJ_BLOB)
41-
return error("Object %s not a blob",
42-
sha1_to_hex(item->object.sha1));
43-
ret = parse_blob_buffer(item, buffer, size);
44-
free(buffer);
45-
return ret;
46-
}

blob.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ struct blob *lookup_blob(const unsigned char *sha1);
1313

1414
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
1515

16-
int parse_blob(struct blob *item);
16+
/**
17+
* Blobs do not contain references to other objects and do not have
18+
* structured data that needs parsing. However, code may use the
19+
* "parsed" bit in the struct object for a blob to determine whether
20+
* its content has been found to actually be available, so
21+
* parse_blob_buffer() is used (by object.c) to flag that the object
22+
* has been read successfully from the database.
23+
**/
1724

1825
#endif /* BLOB_H */

0 commit comments

Comments
 (0)