aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-31 13:14:57 -0800
committerJunio C Hamano <gitster@pobox.com>2017-01-31 13:14:57 -0800
commit42ace93e41da0abe5a264fb8661f1c7de88206ec (patch)
tree937299b26d761c4b1729f86de23c7cad833261cc /cache.h
parente8272fd5fbb4f3a6d264fe0721247efe08aada8f (diff)
parentcce044df7f2392d0c6cb21d6dca94f01ff838727 (diff)
downloadgit-42ace93e41da0abe5a264fb8661f1c7de88206ec.tar.gz
git-42ace93e41da0abe5a264fb8661f1c7de88206ec.tar.xz
Merge branch 'jk/loose-object-fsck'
"git fsck" inspects loose objects more carefully now. * jk/loose-object-fsck: fsck: detect trailing garbage in all object types fsck: parse loose object paths directly sha1_file: add read_loose_object() function t1450: test fsck of packed objects sha1_file: fix error message for alternate objects t1450: refactor loose-object removal
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 00a029af3..5cac28788 100644
--- a/cache.h
+++ b/cache.h
@@ -1143,6 +1143,19 @@ extern int finalize_object_file(const char *tmpfile, const char *filename);
extern int has_sha1_pack(const unsigned char *sha1);
/*
+ * Open the loose object at path, check its sha1, and return the contents,
+ * type, and size. If the object is a blob, then "contents" may return NULL,
+ * to allow streaming of large blobs.
+ *
+ * Returns 0 on success, negative on error (details may be written to stderr).
+ */
+int read_loose_object(const char *path,
+ const unsigned char *expected_sha1,
+ enum object_type *type,
+ unsigned long *size,
+ void **contents);
+
+/*
* Return true iff we have an object named sha1, whether local or in
* an alternate object database, and whether packed or loose. This
* function does not respect replace references.