[PATCH 16/16] sha1_file: allow sha1_loose_object_info to handle arbitrary object stores
From: Stefan Beller <hidden>
Date: 2018-02-16 17:47:11
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Stefan Beller <redacted> --- sha1_file.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 4cbff471a2..31be57249f 100644
--- a/sha1_file.c
+++ b/sha1_file.c@@ -1154,7 +1154,8 @@ int parse_sha1_header(const char *hdr, unsigned long *sizep) return parse_sha1_header_extended(hdr, &oi, 0); } -static int sha1_loose_object_info(const unsigned char *sha1, +static int sha1_loose_object_info(struct raw_object_store *o, + const unsigned char *sha1, struct object_info *oi, int flags) {
@@ -1180,14 +1181,14 @@ static int sha1_loose_object_info(const unsigned char *sha1, if (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) { const char *path; struct stat st; - if (stat_sha1_file(&the_repository->objects, sha1, &st, &path) < 0) + if (stat_sha1_file(o, sha1, &st, &path) < 0) return -1; if (oi->disk_sizep) *oi->disk_sizep = st.st_size; return 0; } - map = map_sha1_file(&the_repository->objects, sha1, &mapsize); + map = map_sha1_file(o, sha1, &mapsize); if (!map) return -1;
@@ -1275,7 +1276,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, break; /* Most likely it's a loose object. */ - if (!sha1_loose_object_info(real, oi, flags)) + if (!sha1_loose_object_info(&the_repository->objects, real, oi, flags)) return 0; /* Not a loose object; someone else may have just packed it. */
--
2.16.1.291.g4437f3f132-goog