diff options
Diffstat (limited to 'upload-pack.c')
-rw-r--r-- | upload-pack.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/upload-pack.c b/upload-pack.c index 83f3d2651a..2537affa90 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -9,13 +9,10 @@ #include "repository.h" #include "object-store-ll.h" #include "oid-array.h" -#include "tag.h" #include "object.h" #include "commit.h" #include "diff.h" #include "revision.h" -#include "list-objects.h" -#include "list-objects-filter.h" #include "list-objects-filter-options.h" #include "run-command.h" #include "connect.h" @@ -24,15 +21,13 @@ #include "string-list.h" #include "strvec.h" #include "trace2.h" -#include "prio-queue.h" #include "protocol.h" -#include "quote.h" #include "upload-pack.h" -#include "serve.h" #include "commit-graph.h" #include "commit-reach.h" #include "shallow.h" #include "write-or-die.h" +#include "json-writer.h" /* Remember to update object flag allocation in object.h */ #define THEY_HAVE (1u << 11) @@ -1552,6 +1547,30 @@ static int parse_have(const char *line, struct oid_array *haves) return 0; } +static void trace2_fetch_info(struct upload_pack_data *data) +{ + struct json_writer jw = JSON_WRITER_INIT; + + jw_object_begin(&jw, 0); + jw_object_intmax(&jw, "haves", data->haves.nr); + jw_object_intmax(&jw, "wants", data->want_obj.nr); + jw_object_intmax(&jw, "want-refs", data->wanted_refs.nr); + jw_object_intmax(&jw, "depth", data->depth); + jw_object_intmax(&jw, "shallows", data->shallows.nr); + jw_object_bool(&jw, "deepen-since", data->deepen_since); + jw_object_intmax(&jw, "deepen-not", data->deepen_not.nr); + jw_object_bool(&jw, "deepen-relative", data->deepen_relative); + if (data->filter_options.choice) + jw_object_string(&jw, "filter", list_object_filter_config_name(data->filter_options.choice)); + else + jw_object_null(&jw, "filter"); + jw_end(&jw); + + trace2_data_json("upload-pack", the_repository, "fetch-info", &jw); + + jw_release(&jw); +} + static void process_args(struct packet_reader *request, struct upload_pack_data *data) { @@ -1640,6 +1659,9 @@ static void process_args(struct packet_reader *request, if (request->status != PACKET_READ_FLUSH) die(_("expected flush after fetch arguments")); + + if (trace2_is_enabled()) + trace2_fetch_info(data); } static int process_haves(struct upload_pack_data *data, struct oid_array *common) |