Signed-off-by: Christian Couder <[email protected]>
---
odb-helper.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/odb-helper.c b/odb-helper.c
index a6bf81af8d..910c87a482 100644
--- a/odb-helper.c
+++ b/odb-helper.c
@@ -142,19 +142,20 @@ static int check_object_process_error(int err,
return err;
}
-static int read_object_process(const unsigned char *sha1)
+static int read_object_process(struct odb_helper *o, const unsigned char
*sha1, int fd)
{
int err;
struct read_object_process *entry;
struct child_process *process;
struct strbuf status = STRBUF_INIT;
- const char *cmd = "read-object";
+ const char *cmd = o->cmd;
uint64_t start;
start = getnanotime();
entry = launch_read_object_process(cmd);
process = &entry->subprocess.process;
+ o->supported_capabilities = entry->supported_capabilities;
if (!(ODB_HELPER_CAP_GET & entry->supported_capabilities))
return -1;
@@ -173,6 +174,13 @@ static int read_object_process(const unsigned char *sha1)
if (err)
goto done;
+ if (o->fetch_kind != ODB_FETCH_KIND_FAULT_IN) {
+ struct strbuf buf;
+ read_packetized_to_strbuf(process->out, &buf);
+ if (err)
+ goto done;
+ }
+
subprocess_read_status(process->out, &status);
err = strcmp(status.buf, "success");
@@ -554,10 +562,11 @@ static int odb_helper_fetch_git_object(struct odb_helper
*o,
int odb_helper_fault_in_object(struct odb_helper *o,
const unsigned char *sha1)
{
- struct odb_helper_object *obj = odb_helper_lookup(o, sha1);
-
- if (!obj)
- return -1;
+ if (o->supported_capabilities & ODB_HELPER_CAP_HAVE) {
+ struct odb_helper_object *obj = odb_helper_lookup(o, sha1);
+ if (!obj)
+ return -1;
+ }
if (o->script_mode) {
struct odb_helper_cmd cmd;
@@ -567,7 +576,7 @@ int odb_helper_fault_in_object(struct odb_helper *o,
return -1;
return 0;
} else {
- return read_object_process(sha1);
+ return read_object_process(o, sha1, -1);
}
}
--
2.13.1.565.gbfcd7a9048