Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit 837d395a5c0b98ab938d71db8e2b6b9f69ddcc4d 1 parent 64161a6
Daniel Barkalow authored gitster committed

Showing 2 changed files with 8 additions and 22 deletions. Show diff stats Hide diff stats

  1. +0 21 blob.c
  2. +8 1 blob.h
21 blob.c
@@ -23,24 +23,3 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
23 23 item->object.parsed = 1;
24 24 return 0;
25 25 }
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   -}
9 blob.h
@@ -13,6 +13,13 @@ struct blob *lookup_blob(const unsigned char *sha1);
13 13
14 14 int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
15 15
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 + **/
17 24
18 25 #endif /* BLOB_H */

0 comments on commit 837d395

Please sign in to comment.
Something went wrong with that request. Please try again.