summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-05-16 12:05:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-05-16 12:05:22 (GMT)
commit644f4a20468da89c1325a539c0521336f7835a64 (patch)
tree39ccb6b55222d659ab3d63d8b91e8ba549c360e5 /upload-pack.c
parent97eea85a0a1ec66d356567808a1e4ca2367e0ce7 (diff)
parent477673d6f39b4829baa98ad88d6b65b35b79fd0f (diff)
downloadgit-644f4a20468da89c1325a539c0521336f7835a64.zip
git-644f4a20468da89c1325a539c0521336f7835a64.tar.gz
git-644f4a20468da89c1325a539c0521336f7835a64.tar.bz2
Merge branch 'jt/push-negotiation'
"git push" learns to discover common ancestor with the receiving end over protocol v2. * jt/push-negotiation: send-pack: support push negotiation fetch: teach independent negotiation (no packfile) fetch-pack: refactor command and capability write fetch-pack: refactor add_haves() fetch-pack: refactor process_acks()
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 5c1cd19..297b76f 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -103,6 +103,7 @@ struct upload_pack_data {
unsigned use_ofs_delta : 1;
unsigned no_progress : 1;
unsigned use_include_tag : 1;
+ unsigned wait_for_done : 1;
unsigned allow_filter : 1;
unsigned allow_filter_fallback : 1;
unsigned long tree_filter_max_depth;
@@ -1496,6 +1497,10 @@ static void process_args(struct packet_reader *request,
data->done = 1;
continue;
}
+ if (!strcmp(arg, "wait-for-done")) {
+ data->wait_for_done = 1;
+ continue;
+ }
/* Shallow related arguments */
if (process_shallow(arg, &data->shallows))
@@ -1578,7 +1583,7 @@ static int send_acks(struct upload_pack_data *data, struct oid_array *acks)
oid_to_hex(&acks->oid[i]));
}
- if (ok_to_give_up(data)) {
+ if (!data->wait_for_done && ok_to_give_up(data)) {
/* Send Ready */
packet_writer_write(&data->writer, "ready\n");
return 1;
@@ -1668,10 +1673,13 @@ int upload_pack_v2(struct repository *r, struct strvec *keys,
case FETCH_PROCESS_ARGS:
process_args(request, &data);
- if (!data.want_obj.nr) {
+ if (!data.want_obj.nr && !data.wait_for_done) {
/*
- * Request didn't contain any 'want' lines,
- * guess they didn't want anything.
+ * Request didn't contain any 'want' lines (and
+ * the request does not contain
+ * "wait-for-done", in which it is reasonable
+ * to just send 'have's without 'want's); guess
+ * they didn't want anything.
*/
state = FETCH_DONE;
} else if (data.haves.nr) {
@@ -1723,7 +1731,7 @@ int upload_pack_advertise(struct repository *r,
int allow_sideband_all_value;
char *str = NULL;
- strbuf_addstr(value, "shallow");
+ strbuf_addstr(value, "shallow wait-for-done");
if (!repo_config_get_bool(the_repository,
"uploadpack.allowfilter",