summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/upload-pack.c b/upload-pack.c
index e19583ae0f..297b76fcb4 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;
@@ -1153,7 +1154,7 @@ static void receive_needs(struct upload_pack_data *data,
static int mark_our_ref(const char *refname, const char *refname_full,
const struct object_id *oid)
{
- struct object *o = lookup_unknown_object(oid);
+ struct object *o = lookup_unknown_object(the_repository, oid);
if (ref_is_hidden(refname, refname_full)) {
o->flags |= HIDDEN_REF;
@@ -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",