diff --git a/external-odb.c b/external-odb.c
index 31d21bfe04..ccca67eff5 100644
--- a/external-odb.c
+++ b/external-odb.c
@@ -32,8 +32,14 @@ static int external_odb_config(const char *var, const char *value, void *data)
o = find_or_create_helper(name, namelen);
- if (!strcmp(subkey, "scriptcommand"))
+ if (!strcmp(subkey, "scriptcommand")) {
+ o->script_mode = 1;
return git_config_string(&o->cmd, var, value);
+ }
+ if (!strcmp(subkey, "subprocesscommand")) {
+ o->script_mode = 0;
+ return git_config_string(&o->cmd, var, value);
+ }
return 0;
}diff --git a/odb-helper.c b/odb-helper.c
index 3d940a3171..22728200e3 100644
--- a/odb-helper.c
+++ b/odb-helper.c
@@ -123,6 +123,9 @@ int odb_helper_init(struct odb_helper *o)
FILE *fh;
struct strbuf line = STRBUF_INIT;
+ if (!o->script_mode)
+ return 0;
+
if (odb_helper_start(o, &cmd, 0, "init") < 0)
return -1;
@@ -173,16 +176,12 @@ static int odb_helper_object_cmp(const void *va, const void *vb)
return hashcmp(a->sha1, b->sha1);
}
-static void odb_helper_load_have(struct odb_helper *o)
+static void have_object_script(struct odb_helper *o)
{
struct odb_helper_cmd cmd;
FILE *fh;
struct strbuf line = STRBUF_INIT;
- if (o->have_valid)
- return;
- o->have_valid = 1;
-
if (odb_helper_start(o, &cmd, 0, "have") < 0)
return;
@@ -194,6 +193,16 @@ static void odb_helper_load_have(struct odb_helper *o)
strbuf_release(&line);
fclose(fh);
odb_helper_finish(o, &cmd);
+}
+
+static void odb_helper_load_have(struct odb_helper *o)
+{
+ if (o->have_valid)
+ return;
+ o->have_valid = 1;
+
+ if (o->script_mode)
+ have_object_script(o);
qsort(o->have, o->have_nr, sizeof(*o->have), odb_helper_object_cmp);
}diff --git a/odb-helper.h b/odb-helper.h
index fbb6d333ee..ee2b09b182 100644
--- a/odb-helper.h
+++ b/odb-helper.h
@@ -15,6 +15,7 @@ struct odb_helper {
const char *name;
const char *cmd;
unsigned int supported_capabilities;
+ int script_mode;
struct odb_helper_object {
unsigned char sha1[20];--
2.14.1.576.g3f707d88cd