Some transports, like the native pack transport implemented by
fetch-pack, support useful features like depth or include tags.
These should be exposed if the underlying helper knows how to
use them.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Shawn O. Pearce15 years agocommitted byJunio C Hamano
@ -35,6 +35,16 @@ Commands are given by the caller on the helper's standard input, one per line.
@@ -35,6 +35,16 @@ Commands are given by the caller on the helper's standard input, one per line.
the name; unrecognized attributes are ignored. After the
complete list, outputs a blank line.
'option' <name> <value>::
Set the transport helper option <name> to <value>. Outputs a
single line containing one of 'ok' (option successfully set),
'unsupported' (option not recognized) or 'error <msg>'
(option <name> is supported but <value> is not correct
for it). Options should be set before other commands,
and may how those commands behave.
+
Supported if the helper has the "option" capability.
'fetch' <sha1> <name>::
Fetches the given object, writing the necessary objects
to the database. Fetch commands are sent in a batch, one
static struct child_process *get_helper(struct transport *transport)
@ -48,6 +50,8 @@ static struct child_process *get_helper(struct transport *transport)
@@ -48,6 +50,8 @@ static struct child_process *get_helper(struct transport *transport)
break;
if (!strcmp(buf.buf, "fetch"))
data->fetch = 1;
if (!strcmp(buf.buf, "option"))
data->option = 1;
}
return data->helper;
}
@ -65,9 +69,88 @@ static int disconnect_helper(struct transport *transport)
@@ -65,9 +69,88 @@ static int disconnect_helper(struct transport *transport)
free(data->helper);
data->helper = NULL;
}
free(data);
return 0;
}
static const char *unsupported_options[] = {
TRANS_OPT_UPLOADPACK,
TRANS_OPT_RECEIVEPACK,
TRANS_OPT_THIN,
TRANS_OPT_KEEP
};
static const char *boolean_options[] = {
TRANS_OPT_THIN,
TRANS_OPT_KEEP,
TRANS_OPT_FOLLOWTAGS
};
static int set_helper_option(struct transport *transport,