summaryrefslogtreecommitdiff
path: root/sha1-file.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-11-14 00:12:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-14 08:22:40 (GMT)
commita3b72c89bdd10f8b22d7dae382f0ce9833e5d179 (patch)
treeac94e5ddd57b0be50068cb8f8923a3ef3daaccd4 /sha1-file.c
parent33b94066f27199071abaa4067d29a98bbbbdae11 (diff)
downloadgit-a3b72c89bdd10f8b22d7dae382f0ce9833e5d179.zip
git-a3b72c89bdd10f8b22d7dae382f0ce9833e5d179.tar.gz
git-a3b72c89bdd10f8b22d7dae382f0ce9833e5d179.tar.bz2
object-store: allow read_object_file_extended to read from any repo
read_object_file_extended is not widely used, so migrate it all at once. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1-file.c')
-rw-r--r--sha1-file.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sha1-file.c b/sha1-file.c
index 856e000..c5b704a 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -1403,7 +1403,8 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
* deal with them should arrange to call read_object() and give error
* messages themselves.
*/
-void *read_object_file_extended(const struct object_id *oid,
+void *read_object_file_extended(struct repository *r,
+ const struct object_id *oid,
enum object_type *type,
unsigned long *size,
int lookup_replace)
@@ -1413,10 +1414,10 @@ void *read_object_file_extended(const struct object_id *oid,
const char *path;
struct stat st;
const struct object_id *repl = lookup_replace ?
- lookup_replace_object(the_repository, oid) : oid;
+ lookup_replace_object(r, oid) : oid;
errno = 0;
- data = read_object(the_repository, repl->hash, type, size);
+ data = read_object(r, repl->hash, type, size);
if (data)
return data;
@@ -1428,11 +1429,11 @@ void *read_object_file_extended(const struct object_id *oid,
die(_("replacement %s not found for %s"),
oid_to_hex(repl), oid_to_hex(oid));
- if (!stat_sha1_file(the_repository, repl->hash, &st, &path))
+ if (!stat_sha1_file(r, repl->hash, &st, &path))
die(_("loose object %s (stored in %s) is corrupt"),
oid_to_hex(repl), path);
- if ((p = has_packed_and_bad(the_repository, repl->hash)) != NULL)
+ if ((p = has_packed_and_bad(r, repl->hash)) != NULL)
die(_("packed object %s (stored in %s) is corrupt"),
oid_to_hex(repl), p->pack_name);