From patchwork Thu Nov 21 20:41:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13882377 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D7871C9B76 for ; Thu, 21 Nov 2024 20:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221844; cv=none; b=Z4GxESGpiAzVeWessMhPVxRdStI+HxPKoeAE/EcgekFXOWdaLUjEOAyl5mrqmazJWVKYeoOms3EVK5oNWPiW/NGAr2uvDi4GehlA0kwcVQAsNyAezm4rKGSVxzW0bmReXv5qjuM13A7808Zd2tbFequ9sp2SYyPXg6QPfSq2tAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221844; c=relaxed/simple; bh=IjFVRAOmo87pEEl1ZPDTdOw04ja2XQ8FrHqIhhoD7Y0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HMtsnFHoOvBInZc/u08/lc8yZWAK7gxFHo7V/mcjDuBW/3bAXwwcedgX07ninKo2EDsBKV0RTCidEqQrh6Beuvz/N5kEIk+2fJomLKRN7dLjwr8x6uP/SD66m9+J72D9Q6TVjel6PsPqt8R+0f5JJkKcr4L5+Z+bHwZVpMwuOdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JxGDKwHA; arc=none smtp.client-ip=209.85.160.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JxGDKwHA" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-2969bf1680cso737819fac.1 for ; Thu, 21 Nov 2024 12:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732221841; x=1732826641; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OmkEFgbT+6pmf1SQ1MtNnGa5PRZNfhwjV+iVOGrGFaE=; b=JxGDKwHAzfR2hVCHRNlIMvevOOC2EhlU+vTT/3ioEF/QTCZbq29umzsjXUEY2+epSJ hxZsGIhpBqh84BnmjHe65V2S8UVq7S4BljynEwNsHJzeaG5MLvZ564m5jO/Doe1nego+ L3CvQogFGkKn0kX6QFbnvqcsq8O3j0Vk2t5APReSBFcNVyH78PDnY83m3tKrAxdvsIfP J6bsmiWjR3+mqtyJnQO2z8uTBqPw4GyQiBq7PqsmAxl5iWUlBrXhpFIFADvY7McfuHYD aO/eBVz3gx9J/JYgZY+/eI4lG0p639EktvsIumbTAdkKu+hMgo5lPGMAZS0BC9rveyYc fApw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732221841; x=1732826641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OmkEFgbT+6pmf1SQ1MtNnGa5PRZNfhwjV+iVOGrGFaE=; b=wMybjjjViDxXOIPAaUTMLpQLZAOmO/ABqWi0elX11PljnuLLsT1qirHZp5xk5xd6xO vGtCDG5Lqn8b1a6FVlMZ7eG30Qa23KfCaQ6f8SJA+ypq6DR7i4Usi1OqfYIvy03OoIIC 2X93aIsHYwXD7+XPzjETNKkGDNZo04qXvTU6h9NCH2QvCcVszHr55+qGLxKIBEcEIPM7 epP1eRQ/frkmg3/wUWKNxRUulSu/jNu5np/XVIJ63q9hfUZUAJrZi1hm4uKA3xnhm7R7 lIu1Lq0H/jaD/Bi6CktXI+IvSrSFHwuEVFDXMydHwBjtEx+VXMsdvFwkE4TjxqF/ddbA PAag== X-Gm-Message-State: AOJu0Yw8Zs6TUNST3aDjQ/I2WP6repjg976scEv4QrZWGzhOXNgvYXYm ZEthFuAgtnGuxJ0rSlXnPRG4RwxcS0PfGRM/pdxbp4qER8FLRkqXP91eKQ== X-Gm-Gg: ASbGnctRWkjhX7QgJFNKzAQMa7UWyEXxQY1zY4uqbYzqLWPwENjfqvfIfi0iE/PGMbN q8JdLKsy3L9SK4JxvCkKPmjcJI7GX/J56uhmegMZjI+1mXmhSQ9aDsR4HdJ6MFiZk0T45uTFbq/ yuxBEUIyx5qOQtXEEDJ4h3aByc83SnNHQlJyL9GCNs1XXFJICsrQZr3/ihZIjRv2b9zEocHdGgs EAMzUmd3aV1i5WKOoiJbJfsui+JnH7Bvmf51DGGy7V02TXG3eWei86POA== X-Google-Smtp-Source: AGHT+IGq6XlCSbz5Hs0bmppyLwCAt3vBdTlT31IbMgdJ/yo6Zzi/xOFhizzTNEKfUzjHUizrW2Xljw== X-Received: by 2002:a05:6870:1f08:b0:297:5a2:d560 with SMTP id 586e51a60fabf-2971e2b17eemr483422fac.4.1732221840739; Thu, 21 Nov 2024 12:44:00 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2971d669843sm126481fac.28.2024.11.21.12.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 12:44:00 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH 1/5] bundle: add bundle verification options type Date: Thu, 21 Nov 2024 14:41:15 -0600 Message-ID: <20241121204119.1440773-2-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241121204119.1440773-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Bundle verification performed as part of `unbundle()` is configurable via providing `verify_bundle_flags`. This is done by invoking `verify_bundle()` and propagating the set flags. If the `VERIFY_BUNDLE_FSCK` flag is provided, the `fsck-objects` flag is specified when invoking git-index-pack(1) to perform fsck checks on the objects in the bundle. Introduce a new type, `verify_bundle_opts`, and update `unbundle()` to accept this instead of `verify_bundle_flags` to perform the same verification configuration. In a subsequent commit, `verify_bundle_opts` will be extended to support configuration of fsck message severity. Signed-off-by: Justin Tobler --- builtin/bundle.c | 2 +- bundle-uri.c | 13 ++++++++----- bundle.c | 14 +++++++++----- bundle.h | 14 +++++++++----- transport.c | 6 ++++-- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/builtin/bundle.c b/builtin/bundle.c index 127518c2a8..15ac75ab51 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -218,7 +218,7 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix) strvec_pushl(&extra_index_pack_args, "-v", "--progress-title", _("Unbundling objects"), NULL); ret = !!unbundle(the_repository, &header, bundle_fd, - &extra_index_pack_args, 0) || + &extra_index_pack_args, NULL) || list_bundle_refs(&header, argc, argv); bundle_header_release(&header); diff --git a/bundle-uri.c b/bundle-uri.c index 0df66e2872..ed3afcaeb3 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -361,12 +361,16 @@ static int copy_uri_to_file(const char *filename, const char *uri) static int unbundle_from_file(struct repository *r, const char *file) { - int result = 0; - int bundle_fd; + struct verify_bundle_opts opts = { + .flags = VERIFY_BUNDLE_QUIET | + (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0) + }; struct bundle_header header = BUNDLE_HEADER_INIT; - struct string_list_item *refname; struct strbuf bundle_ref = STRBUF_INIT; + struct string_list_item *refname; size_t bundle_prefix_len; + int result = 0; + int bundle_fd; bundle_fd = read_bundle_header(file, &header); if (bundle_fd < 0) { @@ -379,8 +383,7 @@ static int unbundle_from_file(struct repository *r, const char *file) * a reachable ref pointing to the new tips, which will reach * the prerequisite commits. */ - result = unbundle(r, &header, bundle_fd, NULL, - VERIFY_BUNDLE_QUIET | (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0)); + result = unbundle(r, &header, bundle_fd, NULL, &opts); if (result) { result = 1; goto cleanup; diff --git a/bundle.c b/bundle.c index 4773b51eb1..db17f50ee0 100644 --- a/bundle.c +++ b/bundle.c @@ -626,13 +626,17 @@ int create_bundle(struct repository *r, const char *path, return ret; } -int unbundle(struct repository *r, struct bundle_header *header, - int bundle_fd, struct strvec *extra_index_pack_args, - enum verify_bundle_flags flags) +int unbundle(struct repository *r, struct bundle_header *header, int bundle_fd, + struct strvec *extra_index_pack_args, + struct verify_bundle_opts *_opts) { struct child_process ip = CHILD_PROCESS_INIT; + struct verify_bundle_opts opts = { 0 }; - if (verify_bundle(r, header, flags)) + if (_opts) + opts = *_opts; + + if (verify_bundle(r, header, opts.flags)) return -1; strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL); @@ -641,7 +645,7 @@ int unbundle(struct repository *r, struct bundle_header *header, if (header->filter.choice) strvec_push(&ip.args, "--promisor=from-bundle"); - if (flags & VERIFY_BUNDLE_FSCK) + if (opts.flags & VERIFY_BUNDLE_FSCK) strvec_push(&ip.args, "--fsck-objects"); if (extra_index_pack_args) diff --git a/bundle.h b/bundle.h index 5ccc9a061a..bddf44c267 100644 --- a/bundle.h +++ b/bundle.h @@ -39,6 +39,10 @@ enum verify_bundle_flags { int verify_bundle(struct repository *r, struct bundle_header *header, enum verify_bundle_flags flags); +struct verify_bundle_opts { + enum verify_bundle_flags flags; +}; + /** * Unbundle after reading the header with read_bundle_header(). * @@ -49,12 +53,12 @@ int verify_bundle(struct repository *r, struct bundle_header *header, * (e.g. "-v" for verbose/progress), NULL otherwise. The provided * "extra_index_pack_args" (if any) will be strvec_clear()'d for you. * - * Before unbundling, this method will call verify_bundle() with the - * given 'flags'. + * Before unbundling, this method will call verify_bundle() with 'flags' + * provided in 'opts'. */ -int unbundle(struct repository *r, struct bundle_header *header, - int bundle_fd, struct strvec *extra_index_pack_args, - enum verify_bundle_flags flags); +int unbundle(struct repository *r, struct bundle_header *header, int bundle_fd, + struct strvec *extra_index_pack_args, + struct verify_bundle_opts *opts); int list_bundle_refs(struct bundle_header *header, int argc, const char **argv); diff --git a/transport.c b/transport.c index 47fda6a773..7e0ec4adc9 100644 --- a/transport.c +++ b/transport.c @@ -176,6 +176,8 @@ static int fetch_refs_from_bundle(struct transport *transport, int nr_heads UNUSED, struct ref **to_fetch UNUSED) { + struct verify_bundle_opts opts = { .flags = fetch_pack_fsck_objects() ? + VERIFY_BUNDLE_FSCK : 0 }; struct bundle_transport_data *data = transport->data; struct strvec extra_index_pack_args = STRVEC_INIT; int ret; @@ -185,9 +187,9 @@ static int fetch_refs_from_bundle(struct transport *transport, if (!data->get_refs_from_bundle_called) get_refs_from_bundle_inner(transport); + ret = unbundle(the_repository, &data->header, data->fd, - &extra_index_pack_args, - fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0); + &extra_index_pack_args, &opts); transport->hash_algo = data->header.hash_algo; strvec_clear(&extra_index_pack_args); From patchwork Thu Nov 21 20:41:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13882378 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3DD61DC06D for ; Thu, 21 Nov 2024 20:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221848; cv=none; b=UkJ7nanQbGWb5SOnNr7ISQbxZdVzglRYrLUAZPeQwNT70otjZuy70er19s3i1Litc0Ea+Cuf/QwYCTpYoUPyz1/i2Y7h5HFAZwaXcZI2MP757xv0eh2sCBsJec/w1d6srWTq7oIywUsPcns60Fq7/oTT8jwAVOIwcB3CiY9C/VA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221848; c=relaxed/simple; bh=Nb9jLAdqJbo4TzBNL70GiKCWiYwQoCy3ipdVR/b3cPY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oZUabnXuDRZhNdTes7IL34txjhZus2V3qN5RbQ0gOFlUm4P6+7mnK8tVRioK8s/7P9Ci2jMaad2Zh1qBbrRZcv7A5uMw8Uwv7ytTwiAyYuSNgYhoUxTnpv0QrJEScWreN9VjZkVsrTObZm8MF+SaUge63wZeX6MDz00qzu9RjLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LqjPjyBC; arc=none smtp.client-ip=209.85.160.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LqjPjyBC" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-296994dd3bfso942659fac.0 for ; Thu, 21 Nov 2024 12:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732221845; x=1732826645; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2yIJxLwLqAjqYTr3aLhST3hNJTRZlCGGYbjlGW4a2eo=; b=LqjPjyBCQn0rLjMQFORNLSEtE0e/KOUFeY4WKpkO4uhp2e/LLY0Fr5Ci75VwOk3OFL tPkGxPKwGl882XFBVExYGEgxUmNOQo6CQtC5INiS6oG81na3UwHa7rnrkbXI3p7qVjtS WfJGauxHIHbQckEPwgE6oXSIeZ4ODYcZ+AFhbZpAmYKK90AJEsqmVH/czGOajXu5apuy wbOdxwL507SS6Dse+vhNH2THxhegQ4SDI4fkMzHfzq19f3RTGx/oXh+KP6B1KVgmxSah q45PIvkIWVxalYf0Qfljybn0D0bzwoc6/sfg50qjr+We70asOHFjatrDtAwp/g+4Ob72 coQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732221845; x=1732826645; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2yIJxLwLqAjqYTr3aLhST3hNJTRZlCGGYbjlGW4a2eo=; b=LmsN2GWHXStenkBd5Pb2t1t8wO215AIMhmNUfhTL8N/6f6UoY2jPpcWSWVQ5fWAmI5 StUjLOvpl6pfzMqnC238EJgcVvImx+gljXsl1xTwvChSUUoLZ5bUF6O73JRRSgLY3vgE gOqOHvW0zTID+1E1wSMOS7nDUStN9YuC3rzPifqyWsUI4h6zkOcdiseLT01SOKR5oeWq Vwxs3PAmUDeAI3Ch5CXgYuBJtrXIhRs8TjXyAouz6lIpzT8naB+7eO0629SXErG3Xx86 3Z2V+WfigbuwTZmSpv/B/bj5TTIU5U4tjibvs45uZbPFo2QJgl3cXiVJACCldhAGbVvy /SZQ== X-Gm-Message-State: AOJu0YyUk1LkbWPBHkIzn0dNhlZk8Lr8Y8Dxx0DzvedNxAdH2BMooIXF zO0s3G+uf3pdoX+hCTsi3Iv/dT+OJc8cMsgUZlYRpI6D/rYjE59f8Q/NTA== X-Gm-Gg: ASbGnct2w4CfOZGs9TMoBwdrgGEqpKmLNUBj4pduIGHA8wSxUI9PGVC+ulCNkOCV1jS 76JM2Va9Otc3ZJWej3wysignNygf1rycpk++kCVK/JArkEMW03gthFxeKiKEt73TS9VlxYsQ6VH 9YOfh3I6mwFzeeOFyRUdg+qg31e3VrcbEWu/+MNlb2QlTQBPnI/zdc/dc7MycFuw/Z1zhJVv3Cw zyXR93n8zSTjdJx6WSvkF2g3xK3jzpWdxzH90KlSKR8L4HleEioKA0ajw== X-Google-Smtp-Source: AGHT+IF1B4kbocK6RBQxgTha7l/wA5TC13IbNE+qFoVSEwiQ44bszzXi4oNhHnRSVEdM2umYc5N5Uw== X-Received: by 2002:a05:6870:ac99:b0:296:ff2c:7736 with SMTP id 586e51a60fabf-29720b8e654mr382211fac.10.1732221845099; Thu, 21 Nov 2024 12:44:05 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2971d669843sm126481fac.28.2024.11.21.12.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 12:44:04 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH 2/5] bundle: support fsck message configuration Date: Thu, 21 Nov 2024 14:41:16 -0600 Message-ID: <20241121204119.1440773-3-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241121204119.1440773-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The git-index-pack(1) spawned during `unbundle()` can be optionally configured with `--fsck-objects` to perform fsck checks on the bundle. This does not propagate fsck message severity configuration though. Extend `verify_bundle_opts` to store this information and update `unbundle()` to configure the `--fsck-objects` option appropriately. Signed-off-by: Justin Tobler --- bundle.c | 3 ++- bundle.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bundle.c b/bundle.c index db17f50ee0..97b70e2e51 100644 --- a/bundle.c +++ b/bundle.c @@ -646,7 +646,8 @@ int unbundle(struct repository *r, struct bundle_header *header, int bundle_fd, strvec_push(&ip.args, "--promisor=from-bundle"); if (opts.flags & VERIFY_BUNDLE_FSCK) - strvec_push(&ip.args, "--fsck-objects"); + strvec_pushf(&ip.args, "--fsck-objects%s", + opts.fsck_msg_types ? opts.fsck_msg_types : ""); if (extra_index_pack_args) strvec_pushv(&ip.args, extra_index_pack_args->v); diff --git a/bundle.h b/bundle.h index bddf44c267..2a7b556f83 100644 --- a/bundle.h +++ b/bundle.h @@ -41,6 +41,7 @@ int verify_bundle(struct repository *r, struct bundle_header *header, struct verify_bundle_opts { enum verify_bundle_flags flags; + const char *fsck_msg_types; }; /** From patchwork Thu Nov 21 20:41:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13882379 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C4DA83CDA for ; Thu, 21 Nov 2024 20:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221849; cv=none; b=Tevd8wqbeq3ss03uPwukaGQWpxGDnXp/GfdTiA/srCbgYQOpyZMIsCSxvZMd+taQmHHbkOkpCkClmVx03/ar9B8N8tt7IOhKADlL3XBDML3zi+avjXOXppwxAdW5oMxrHq/U02k9s80qZB3c5adK7ro34IwjV6QAef3SEbRkYds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221849; c=relaxed/simple; bh=56ziYKkAAf8UgtK3mBXWeSvxtT80Och/mLI8a3zjiSI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=erccqX0cAfBi6wuJcHQchqLvCPwmYWsyKm4sZAQ3cHxwBMf395a/qANocEqPB2RRzdlv3Z0C3JspSL2TXdmfVoFfnOct/SRLY/QazCOfNPm5vxJYaBF7Lj70wZ/73V3diPBYKuqWR9N97jnn7MucVDGd0kNorKe1sz2Ahguap5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Sf4qf3s9; arc=none smtp.client-ip=209.85.160.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sf4qf3s9" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-2967af48248so828260fac.2 for ; Thu, 21 Nov 2024 12:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732221847; x=1732826647; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5rjI5PNefyH9wwX9OS3o+hM06SN2urMIWBkrzg9TLQY=; b=Sf4qf3s9b+/RRefx5PLz5A5flhTkbc7TJPcDUHR22AkPs0FAMtGsK1iaBkq8B/D5OI JB9W3Mcf/SpNgEggtiHeWpoq432+RvEwSNdWwcqSA8wiwVUEdxOXgl2ns3pNeWYY4cVm b/UY09dKpwhEA8gbhq2XiJ4PHbxFTDgDGuswrDtlglRWEuUiv4sUsRLfC5ZAV2aNwvTL VhBMwUTiK7+yn/WzgLtqQDMic8lwuCvPwSFqRlh9Qfz0l/lD73W+S1JEXPpPoenQYXD8 VRGt0bqJ6e5Sok9AmpW6zq6LderdNSv9iUwLkhaX0cY84hsTysDionBJOYIpdwF/eRYQ DZQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732221847; x=1732826647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5rjI5PNefyH9wwX9OS3o+hM06SN2urMIWBkrzg9TLQY=; b=PEILPpNQesCDnlaiwzTj6wi89fVNmvUTBAZlPFxkeCrqxrczNoV3g53bd7fbw4tvOp JAdjF6JmHeZ488Bvut1GkKdq86FaC+O+XZq9YwYtkbXl3QUbxT4hoR+CYixNcJ6trhOh PISVkOKuQMcqnAL1SrwrD4wFuC/TnED0uD5/Xmdi4i0X/SAinYLmLabd8KkXOEldB9Gk TFP4Xnj6LwI438xGHYzEmFUVPWs0fIPx2UDczQw9p4xOKXOMqvPk/aUf+93JqZOyd4cQ aO3DTYJwZqitQAFYSCxH7j6Hsy5r9XF2e6Vg17rVJZE2tQs5Nmb3u2+tMPFTo9GoncSX n7EA== X-Gm-Message-State: AOJu0YyXI8+vS8VSOds9IP0DnsuK5Jo8z27AqLI3FsvldIVMYCVZ5RbJ Iux7jaNowgSYgCdjOYK5K4JKxB6PdJjNrXYK+ofAU0Rieeq172+qlxKweg== X-Gm-Gg: ASbGncslvQbZa6wKecpN/IfZ0j7ZIGsgL/+/mdECnuA351MXlIDaCVyxB7Cci+zx7Jm wmlLivXuUyVZ3zJVpNzj8CZvWfqY1qSaMfYmeoKvJmKsjwyiGRBv9ra09jls5lqqTfHB8B5CrkM XQXZ+yL0h8jQIT1pBxi09WiMoFPBKllIOBj4xXa06yPUkk54OnDM/VDaeZIwPWlVMvIf7yxBv7F 5woz4b71Gj2NtlP5DHwHyrfz42cxGcXAakaeNdXyuEYylVQULrP1V7kCQ== X-Google-Smtp-Source: AGHT+IHCNhdwnjogsxMfr4pJNWXihXV62DltrGRjSJg44yoDm/tbflezTSM2m779olgaDMI3hInRQA== X-Received: by 2002:a05:6870:ac10:b0:288:4823:fe1b with SMTP id 586e51a60fabf-29720b9abdcmr255723fac.17.1732221846976; Thu, 21 Nov 2024 12:44:06 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2971d669843sm126481fac.28.2024.11.21.12.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 12:44:06 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH 3/5] fetch-pack: introduce `fetch_pack_options` Date: Thu, 21 Nov 2024 14:41:17 -0600 Message-ID: <20241121204119.1440773-4-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241121204119.1440773-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When `fetch_pack_config()` is invoked, fetch-pack configuration is parsed from the config. As part of this operation, fsck message severity configuration is assigned to the `fsck_msg_types` global variable. This is optionally used to configure the downstream git-index-pack(1) when the `--strict` option is specified. In a subsequent commit, the same fetch-pack fsck message configuration needs to be reused. To facilitate this, introduce `fetch_pack_options` which gets written to during the `fetch_pack_config_cb()` instead of directly modifying the `fsck_msg_types` global. Signed-off-by: Justin Tobler --- fetch-pack.c | 16 +++++++++------- fetch-pack.h | 8 ++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fetch-pack.c b/fetch-pack.c index fe1fb3c1b7..73309f8043 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -48,8 +48,8 @@ static int server_supports_filtering; static int advertise_sid; static struct shallow_lock shallow_lock; static const char *alternate_shallow_file; +static struct fetch_pack_options fetch_pack_options = FETCH_PACK_OPTIONS_INIT; static struct fsck_options fsck_options = FSCK_OPTIONS_MISSING_GITMODULES; -static struct strbuf fsck_msg_types = STRBUF_INIT; static struct string_list uri_protocols = STRING_LIST_INIT_DUP; /* Remember to update object flag allocation in object.h */ @@ -1017,7 +1017,7 @@ static int get_pack(struct fetch_pack_args *args, strvec_push(&cmd.args, "--fsck-objects"); else strvec_pushf(&cmd.args, "--strict%s", - fsck_msg_types.buf); + fetch_pack_options.fsck_msg_types.buf); } if (index_pack_args) { @@ -1860,6 +1860,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, static int fetch_pack_config_cb(const char *var, const char *value, const struct config_context *ctx, void *cb) { + struct fetch_pack_options *opts = cb; const char *msg_id; if (strcmp(var, "fetch.fsck.skiplist") == 0) { @@ -1867,8 +1868,8 @@ static int fetch_pack_config_cb(const char *var, const char *value, if (git_config_pathname(&path, var, value)) return 1; - strbuf_addf(&fsck_msg_types, "%cskiplist=%s", - fsck_msg_types.len ? ',' : '=', path); + strbuf_addf(&opts->fsck_msg_types, "%cskiplist=%s", + opts->fsck_msg_types.len ? ',' : '=', path); free(path); return 0; } @@ -1877,8 +1878,9 @@ static int fetch_pack_config_cb(const char *var, const char *value, if (!value) return config_error_nonbool(var); if (is_valid_msg_type(msg_id, value)) - strbuf_addf(&fsck_msg_types, "%c%s=%s", - fsck_msg_types.len ? ',' : '=', msg_id, value); + strbuf_addf(&opts->fsck_msg_types, "%c%s=%s", + opts->fsck_msg_types.len ? ',' : '=', + msg_id, value); else warning("Skipping unknown msg id '%s'", msg_id); return 0; @@ -1904,7 +1906,7 @@ static void fetch_pack_config(void) } } - git_config(fetch_pack_config_cb, NULL); + git_config(fetch_pack_config_cb, &fetch_pack_options); } static void fetch_pack_setup(void) diff --git a/fetch-pack.h b/fetch-pack.h index b5c579cdae..8243b754ce 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -106,4 +106,12 @@ int report_unmatched_refs(struct ref **sought, int nr_sought); */ int fetch_pack_fsck_objects(void); +struct fetch_pack_options { + struct strbuf fsck_msg_types; +}; + +#define FETCH_PACK_OPTIONS_INIT { \ + .fsck_msg_types = STRBUF_INIT, \ +} + #endif From patchwork Thu Nov 21 20:41:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13882380 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2ACA11DDA2E for ; Thu, 21 Nov 2024 20:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221851; cv=none; b=gE8+Gcr0HagP1TP8rym3/k3zA62Gvvh2awONdrRbjRcq4d6Ss/Ytoq/j9WXA9DwYkrSFnR+mctQuMKkyCCOqgv6zeKb6B+W4dp8xpHi5oxpaYLesm9cmTI/AiwK37buTrsKqMNRqaQ77SZ8d6znvi6AvmOFBxZaExwb/gYBihxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221851; c=relaxed/simple; bh=bVgG0O0yE14ZUIjX5CaOKfeKmzwrVzoSlBzuM0w/jBY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U+zu1cLA1LYY35mRxnCKGs2gaBnFRWgDANosPvL/D2qY+gA4aowNm56w1QJmFK1H+SvJGNleC20eFGsDoWStrINyIUuEFdDSy0I3MDQMSpmcIR26KQ3ihHYVTuzBIHnk7vNtIcS3fQGdTrLPCA5NAIQWkByoYewr9WCBBePtp24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NwdKUM9t; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NwdKUM9t" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-29645a83b1bso880834fac.1 for ; Thu, 21 Nov 2024 12:44:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732221849; x=1732826649; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hZTRd/YRxheGKQ3Um9aqxW/l7wDYAHTttQgGllc/+08=; b=NwdKUM9toEcgZ/1fZvIHFLy0NYJoUtscdN8Gx0d/KRem3Gw6eJfEyGz6PH5tk9hQpV cREBQAsZWr6vkUq4772Xkg+msAyer0zNUTI1P7QXon1jk439AwK1G3Zb6+2NcL5RuXNM 67z4Sy1JFLXXKkjThcy9MG3p+9j8M3h/W07krGmhcM+IaV0hEe9UsEmFzAxcVdlAJUH/ fG4h/KW7B5sn1xyMFiryiv2WX3cmng19qxkNOgfT/OyeVQ6WPEd1BNKfIRboLBZgjmqT oE1p3b6ApHe9MQV3MzLxwiQY85CpD+Lcwc+B4VafOiDOndxIzxAjk+GuA7GVAFPeM/Vr zY+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732221849; x=1732826649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hZTRd/YRxheGKQ3Um9aqxW/l7wDYAHTttQgGllc/+08=; b=Y/BkQmSg/GOXsI7bsfGos45l+IC482lIx+NDVN+iX5e+YIBluyaKSQD1ZSKmmhM71K NyR1Sc1R8TRegDgzsjblTAh/2VaHbrK1Y9Bnc6QyblTbOAw5TXlygZ5hoGaJ3324KkVb LrZXAd5fxZzrOX3fjI912jsGPxGIENEREzkxr0GOXYCN9qY7HksnodcaEjI/t/Tag9Ff +am2ddRkuCLAAHLk/JR2AFRaiA79HCJUN8hcUJwiQnyTAk/x/Eszivhm9NhyCWg7UOI6 wMbD0D3HHyQ6zPqJiEXQ8zNKzYI4G75BNq7GFJBM7xh+ln8xTbH2tTx6ApjiDSRqYI36 ikjQ== X-Gm-Message-State: AOJu0YxwaC1RJY2BkWXS12xjroZ8IuGy6noWgfWbrSCwpkBkduS9YdGQ WTfN94e1leYXsMwnFbv7flhVh6upphrmkPw6DvVx5oKe7v56vUeqlUyO8g== X-Gm-Gg: ASbGnctw+2iFTBhDrhp2G4GttGA2xPvgjnpKuIW7TsEh983bYg2Afd8nCezPGbHZpaZ Y++sMg0N6W1w8Y0J5Vg0pjEpJR2dwiGa+NWrzi9sSARN07AhiwhXw5P4+Z1c42RKk0DPAgprZFF T+6dtFuiaHSS54q800Ucr17ENOd91VN5T4u517bDrnsFV6CztzSGYHzWokuZr1IzkPme/AgWlub zDBSsur006NBwVe+hs9Kpl9bE6uWMJp13Hn152dRGV79iFNmtZruI1EcQ== X-Google-Smtp-Source: AGHT+IHxa3J7UeSZ3IMe51hfaM3jLfoRSIojo2OGTh7sGqLffp5qrKy+k8cDRvK81KtwAYh5Td+xMA== X-Received: by 2002:a05:6871:3a09:b0:27b:583b:bfc2 with SMTP id 586e51a60fabf-297206b0e3bmr411420fac.0.1732221848929; Thu, 21 Nov 2024 12:44:08 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2971d669843sm126481fac.28.2024.11.21.12.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 12:44:08 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH 4/5] fetch-pack: expose `fetch_pack_config_cb()` Date: Thu, 21 Nov 2024 14:41:18 -0600 Message-ID: <20241121204119.1440773-5-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241121204119.1440773-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 During fetch-pack operations, git-index-pack(1) may be spawned and perform fsck checks. The message severity of these checks is configurable and propagated via appending it to the `--fsck-objects` option. With `fetch_pack_config_cb()`, fsck configuration gets populated to a `fetch_pack_options`. Expose `fetch_pack_config_cb()`, to facilitate formatted fsck message configuration generation. In a subsequent commit, this is used to wire message configuration to `unbundle()` during bundle fetches. Signed-off-by: Justin Tobler --- fetch-pack.c | 4 ++-- fetch-pack.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fetch-pack.c b/fetch-pack.c index 73309f8043..10b66795bc 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1857,8 +1857,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, return ref; } -static int fetch_pack_config_cb(const char *var, const char *value, - const struct config_context *ctx, void *cb) +int fetch_pack_config_cb(const char *var, const char *value, + const struct config_context *ctx, void *cb) { struct fetch_pack_options *opts = cb; const char *msg_id; diff --git a/fetch-pack.h b/fetch-pack.h index 8243b754ce..f35a75a3c5 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -1,6 +1,7 @@ #ifndef FETCH_PACK_H #define FETCH_PACK_H +#include "config.h" #include "string-list.h" #include "protocol.h" #include "list-objects-filter-options.h" @@ -114,4 +115,7 @@ struct fetch_pack_options { .fsck_msg_types = STRBUF_INIT, \ } +int fetch_pack_config_cb(const char *var, const char *value, + const struct config_context *ctx, void *cb); + #endif From patchwork Thu Nov 21 20:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13882381 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 087351DDC26 for ; Thu, 21 Nov 2024 20:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221855; cv=none; b=UJ0UfBLp0t9eL8tV4/T7u/zIiTmCPnnNwrmRmMTJkU9z0DKZzFlJX8ccMZ9EKBDL1299Rhq71BLjteTN7E4mLgjDw7ywd+PCHVY38Ijej6mPQ2Otvp4Db3WBXiaCrq/gri7b4LfN5n/k0x4NTIUuM+qZcg3Zptl+wNRX+rL2RP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732221855; c=relaxed/simple; bh=GzQu76b2LgJX07xw51Zu0B7QVJm95jf7WslnbzvR4bI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L05RUZexOFYYarArsPTAhQg8CydnhBXV2fl3F981FrKuGz+e8aJxvYFBfVOcz0MTCPIUQmrv/kN6Gn6jCKXGBBNYN3tLf6jKcyfTzJezw3Va6NWm4WI0ATg1NFeKR30wUBT8unSx7fdlrdgZCDRGPXyBW/IO7iO248Th5tRjtxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Yj9+uG1F; arc=none smtp.client-ip=209.85.160.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Yj9+uG1F" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-29654932226so636628fac.0 for ; Thu, 21 Nov 2024 12:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732221852; x=1732826652; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PX4JkPWNISux9YEEGE7qMGbWBY0jlVYKJUQpCnx71ZM=; b=Yj9+uG1FAYzSRWd0hWubgqr7P9XgM/9vwgZLzwA89ft2WssQyN/fXmsxYVxteYBJ1d SQXFrk3xZ95XYPXSp0dcpuMW4zvL14OgDmfIHynunS3bIqYVGHNE5pGBH4PRe1WbhuRN m1MZtVcheFXHkk60nyEzeoM38ABjS9edDrqOgutEhjT1emNNdfvdZtWvzqLHS+Y58xQT yg2FlvAMYbSH+N6X8Y+p7cqkSbkmGN0x+QqFHk0LBjwrHoqsjUiWeG9R4nBba6KHnqPA bE3sHtloSTw7orlV+VMCuoCplGOKcRECn8bE7hLLp5AXLHLQR+WWyOhjXwPs6yHRaefz jHeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732221852; x=1732826652; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PX4JkPWNISux9YEEGE7qMGbWBY0jlVYKJUQpCnx71ZM=; b=BC/m7kASAE0koZHOaDwLmtQcwigubNEwKXfNEufEZIX86mwVbzqhU2NfwWpmOmn7/u ERrtG2uuzOqZrhVtXiwrU3p0hbLtSmWHkYG4FQvK169b+bTPSd4fM/ubOg8Z1txmH0x/ mXnF4LJ8ixkjGakCffqUG5/HiQr9WNd6wuyO1/dDBzQZbgDtXQIKBgyw45As1IabckTl cjdk450rV8k9ex16Gr7GMHCrk1SdzqylVEca0hn3eZJCyuPjpM6j21fyhi6Y8IMA8G/0 tTSKaKlHlMms/oyxm8EGvbhWkHOCQCuyVYMScdOnEjPy88pYt4Y3uVqTUJBaT4mVDRnB zLew== X-Gm-Message-State: AOJu0YwzfPI0vAVrHSIqsHeay+xwYCQzOfc/iSAJIElAJxZ+SCZR0LSd n65NVtTkVcoXiNmn4Bf1ZJf71vH+F+rEhecNgUt0RgrWJzJrnzKkbyrOZw== X-Gm-Gg: ASbGnctIBittetZ4al4Cxe/rPshp+h5UmkfUHyyPz8QKRAGj7MQ70w1QwPS5muwQb2s WIlhqedWEm1IE9B7iBLWJ+iJZemfzw2GdF6f61mPIs+9t6LR8tiAIOxbsr8Kt/JHldAbORLjGMH osvxGYMyNF78Cq7o76DuHfcinESGG7INOGCWvDjcgIPpaPmihuLjnx+tfeZ4kuSBWt8BPQDv+nK ppYvsV/XJ9V6py/yTQnhVxTVZEWyQWQ2c9vDdPf3ZSL2uroHUGaNIujkQ== X-Google-Smtp-Source: AGHT+IFfe5lK/tlomVdpyT7PJ9rGtgKkmMr85Y7QRB+x4jkBYdgP4pz5rDmflpzv72CBRx5TuZuZpQ== X-Received: by 2002:a05:6870:3d85:b0:277:ca34:27e9 with SMTP id 586e51a60fabf-2971e329afcmr557282fac.6.1732221852555; Thu, 21 Nov 2024 12:44:12 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2971d669843sm126481fac.28.2024.11.21.12.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 12:44:11 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH 5/5] transport: propagate fsck configuration during bundle fetch Date: Thu, 21 Nov 2024 14:41:19 -0600 Message-ID: <20241121204119.1440773-6-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241121204119.1440773-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When fetching directly from a bundle, fsck message severity configuration is not propagated to the underlying git-index-pack(1). It is only capable of enabling or disabling fsck checks entirely. This does not align with the fsck behavior for fetches through git-fetch-pack(1). Use the message configuration from fetch-pack and wire it through to `unbundle()` to enable the same fsck configuration as done through fetch-pack. Signed-off-by: Justin Tobler --- t/t5607-clone-bundle.sh | 7 +++++++ transport.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/t/t5607-clone-bundle.sh b/t/t5607-clone-bundle.sh index 7ceaa8194d..c69aa88eae 100755 --- a/t/t5607-clone-bundle.sh +++ b/t/t5607-clone-bundle.sh @@ -171,6 +171,13 @@ test_expect_success 'clone bundle with different fsckObjects configurations' ' test_must_fail git -c transfer.fsckObjects=true \ clone bundle-fsck/bad.bundle bundle-transfer-fsck 2>err && + test_grep "missingEmail" err && + + git -c fetch.fsckObjects=true -c fetch.fsck.missingEmail=ignore \ + clone bundle-fsck/bad.bundle bundle-fsck-ignore && + + test_must_fail git -c fetch.fsckObjects=true -c fetch.fsck.missingEmail=error \ + clone bundle-fsck/bad.bundle bundle-fsck-error 2>err && test_grep "missingEmail" err ' diff --git a/transport.c b/transport.c index 7e0ec4adc9..a9e03c3964 100644 --- a/transport.c +++ b/transport.c @@ -178,6 +178,7 @@ static int fetch_refs_from_bundle(struct transport *transport, { struct verify_bundle_opts opts = { .flags = fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0 }; + struct fetch_pack_options fetch_pack_options = FETCH_PACK_OPTIONS_INIT; struct bundle_transport_data *data = transport->data; struct strvec extra_index_pack_args = STRVEC_INIT; int ret; @@ -188,11 +189,15 @@ static int fetch_refs_from_bundle(struct transport *transport, if (!data->get_refs_from_bundle_called) get_refs_from_bundle_inner(transport); + git_config(fetch_pack_config_cb, &fetch_pack_options); + opts.fsck_msg_types = fetch_pack_options.fsck_msg_types.buf; + ret = unbundle(the_repository, &data->header, data->fd, &extra_index_pack_args, &opts); transport->hash_algo = data->header.hash_algo; strvec_clear(&extra_index_pack_args); + strbuf_release(&fetch_pack_options.fsck_msg_types); return ret; }