summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2019-01-16 19:28:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-17 19:25:07 (GMT)
commit0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10 (patch)
tree09c885895d97cd7c5d1243035ca281be098123ab /upload-pack.c
parentfbd76cd450e6675cbd5d48da3c53fa446b776475 (diff)
downloadgit-0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10.zip
git-0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10.tar.gz
git-0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10.tar.bz2
{fetch,upload}-pack: sideband v2 fetch response
Currently, a response to a fetch request has sideband support only while the packfile is being sent, meaning that the server cannot send notices until the start of the packfile. Extend sideband support in protocol v2 fetch responses to the whole response. upload-pack will advertise it if the uploadpack.allowsidebandall configuration variable is set, and fetch-pack will automatically request it if advertised. If the sideband is to be used throughout the whole response, upload-pack will use it to send errors instead of prefixing a PKT-LINE payload with "ERR ". This will be tested in a subsequent patch. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 60a26bb..765b769 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -71,6 +71,8 @@ static int allow_filter;
static int allow_ref_in_want;
static struct list_objects_filter_options filter_options;
+static int allow_sideband_all;
+
static void reset_timeout(void)
{
alarm(timeout);
@@ -1046,6 +1048,8 @@ static int upload_pack_config(const char *var, const char *value, void *unused)
allow_filter = git_config_bool(var, value);
} else if (!strcmp("uploadpack.allowrefinwant", var)) {
allow_ref_in_want = git_config_bool(var, value);
+ } else if (!strcmp("uploadpack.allowsidebandall", var)) {
+ allow_sideband_all = git_config_bool(var, value);
}
if (current_config_scope() != CONFIG_SCOPE_REPO) {
@@ -1284,6 +1288,11 @@ static void process_args(struct packet_reader *request,
continue;
}
+ if (allow_sideband_all && !strcmp(arg, "sideband-all")) {
+ data->writer.use_sideband = 1;
+ continue;
+ }
+
/* ignore unknown lines maybe? */
die("unexpected line: '%s'", arg);
}
@@ -1496,6 +1505,7 @@ int upload_pack_advertise(struct repository *r,
if (value) {
int allow_filter_value;
int allow_ref_in_want;
+ int allow_sideband_all_value;
strbuf_addstr(value, "shallow");
@@ -1510,6 +1520,12 @@ int upload_pack_advertise(struct repository *r,
&allow_ref_in_want) &&
allow_ref_in_want)
strbuf_addstr(value, " ref-in-want");
+
+ if (!repo_config_get_bool(the_repository,
+ "uploadpack.allowsidebandall",
+ &allow_sideband_all_value) &&
+ allow_sideband_all_value)
+ strbuf_addstr(value, " sideband-all");
}
return 1;