From patchwork Wed Nov 27 00:57:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13886466 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 5DFCDD2FB for ; Wed, 27 Nov 2024 01:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669203; cv=none; b=lEIolkBQQfkZN1QlB1wBPmTgBfb8+vuy17C2TZsbpswsi4GSLChDP/65mOYoXVcmRqvqXvz0a2C78JgRtM1jl+nzjsiAnjaWxvVGz8K4TGK1mgADqLcZYtvgAQzqsYjRoXKrf1FRu1Bp21DE6TxExz5e9rozJTPfLW25l8ybNbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669203; c=relaxed/simple; bh=wtw4IqE1Bvc2CzKKYsqjndJA50WqpmlP+DG+nS8iZ1o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j0PvZ0DTOqQRwNwMWOMmdgyyrUF03Ay0zlTgqKfAaYKWnIz54cdtiGYneavU2yvNnuDJL7ajhye1Ehx7psVORAl6iofG/JoKVaPDdyXBwz4+bDsUvUrBKoEFXcMQHVG8urr4XEfo7o2HJHZ9IaOACWN8VGghqL5ab4UIJj5ybBs= 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=fcqRLLz6; arc=none smtp.client-ip=209.85.210.44 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="fcqRLLz6" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-71d50b89132so1206555a34.2 for ; Tue, 26 Nov 2024 17:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732669200; x=1733274000; 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=hhauHutODHFANCW4hs0xz+fYr1BuPMFJVuyibdfT4/A=; b=fcqRLLz6mO8BCjvC/Aszd7HRkwWABHFlzHTMCnJTryJ1vJpZXU0DiqHxJWDrBh/syx hskua3DTOXmNUCweI/D2wpaxf980fRL4ETjPR5owas4jAOPv6h5ZwMoeywJSnYfpyMHd VaeK9mmJ2jK714xOWVKigzALWTSd4srPciC4GyLNDM0HRVNkHc0lvIq4SCPtK9v8Ll/P usdcVsSz1s9bQKZAjJTy0UXGgYhnfKut6do1vsUT/ccbV7tL20V05g4yQyri+QJuA+AQ h9jgcoRjx+aW7c+uIVI3CmHJIV/HpEfujBopWWMIzsTuzAQDmMGWowzJBXCsSB95Q+GK YU0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732669200; x=1733274000; 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=hhauHutODHFANCW4hs0xz+fYr1BuPMFJVuyibdfT4/A=; b=clwLtQYisTs+yOO4CWN55WwjiJqHUmMduJy+8nzFHSCeTtOnAZlaUDoyRwaCbGhAaO /Yh097Rb3+ZIBaaDAnIeebF1E6zdI3/jOWpS53jVsQi+CesNISmvEG11+Mgn3GruByRm Q/1m91VEcpoKQd52V2Wby4hR+n8JxrzWSrHasUxnoFnsyMADrGQ8hVDtISyBoxYoSSrx RtzGICkQdcvMp7VZrLtI04uWwKAwAel3wmIw/0nLNDbsFn6LsYvFruT/m5fUTXzi5oJT C2InO+sAY67ZP94HoQkqE20/yna3tBwO4XhnD9b0G1KP+zVlfoS0evFBrYs5lyQaSoEu poQw== X-Gm-Message-State: AOJu0YyGZOGn1iyVfCRF0A+rq4A01kNVzPAFjEEYZ8PxVMA8XKXdzai3 dHuA27ZnoRS/l2ogear2dAY4+wpAFoLE0ZqEz3SinS0RZgg/2os7qOrJHA== X-Gm-Gg: ASbGncu8XMPgh5x6ZYLtt9eCrOqy6d2JXQ2Tms4dAH6u5XJcSulalB5j0ztrpzasbJv m3dLQY6VG0QwYQMy9hj1uYT0ug3+UL7zaX/+AbEc3Lj0wORiTIsI7UyK+6Iis3recihcpqIiA+q lYmqtW8HO4vuvHuG8XlOqrY2kMfYjVUWkT7/qnMhSDulK7Pe/zZkxXE+3D/dO0SRPi7tgbp1653 mB6SfGLPNvJDyOg6DZnNoFdonUFii7zTcCOTtJYiOb+IQBjoy7Sge4guw== X-Google-Smtp-Source: AGHT+IHAPwJapobjdgJPp5L+cMFdgUNDvhTa+JAQbmtgd06zb8/h2drNj01YpHYtbKxzPUaaL08ZgA== X-Received: by 2002:a05:6830:6f8c:b0:71d:4385:665e with SMTP id 46e09a7af769-71d65c93a1bmr587684a34.9.1732669200104; Tue, 26 Nov 2024 17:00:00 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71c0378d26esm3316643a34.31.2024.11.26.16.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 16:59:59 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH v2 1/4] bundle: add bundle verification options type Date: Tue, 26 Nov 2024 18:57:04 -0600 Message-ID: <20241127005707.319881-2-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127005707.319881-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> <20241127005707.319881-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When `unbundle()` is invoked, fsck verification may be configured by passing the `VERIFY_BUNDLE_FSCK` flag. This mechanism allows fsck checks on the bundle to be enabled or disabled entirely. To facilitate more fine-grained fsck configuration, additional context must be provided to `unbundle()`. Introduce the `unbundle_opts` type, which wraps the existing `verify_bundle_flags`, to facilitate future extension of `unbundle()` configuration. Also update `unbundle()` and its call sites to accept this new options type instead of the flags directly. The end behavior is functionally the same, but allows for the set of configurable options to be extended. This is leveraged in a subsequent commit to enable fsck message severity configuration. Signed-off-by: Justin Tobler --- builtin/bundle.c | 2 +- bundle-uri.c | 7 +++++-- bundle.c | 6 +++++- bundle.h | 10 +++++++--- transport.c | 6 ++++-- 5 files changed, 22 insertions(+), 9 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..cdf9e4f9e1 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -367,6 +367,10 @@ static int unbundle_from_file(struct repository *r, const char *file) struct string_list_item *refname; struct strbuf bundle_ref = STRBUF_INIT; size_t bundle_prefix_len; + struct unbundle_opts opts = { + .flags = VERIFY_BUNDLE_QUIET | + (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0), + }; 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..485033ea3f 100644 --- a/bundle.c +++ b/bundle.c @@ -628,9 +628,13 @@ int create_bundle(struct repository *r, const char *path, int unbundle(struct repository *r, struct bundle_header *header, int bundle_fd, struct strvec *extra_index_pack_args, - enum verify_bundle_flags flags) + struct unbundle_opts *opts) { struct child_process ip = CHILD_PROCESS_INIT; + enum verify_bundle_flags flags = 0; + + if (opts) + flags = opts->flags; if (verify_bundle(r, header, flags)) return -1; diff --git a/bundle.h b/bundle.h index 5ccc9a061a..6a09cc7bfb 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 unbundle_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); + struct unbundle_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..8536b14181 100644 --- a/transport.c +++ b/transport.c @@ -176,6 +176,9 @@ static int fetch_refs_from_bundle(struct transport *transport, int nr_heads UNUSED, struct ref **to_fetch UNUSED) { + struct unbundle_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; @@ -186,8 +189,7 @@ 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 Wed Nov 27 00:57:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13886467 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (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 2A67D1CABF for ; Wed, 27 Nov 2024 01:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669206; cv=none; b=L8VlMKKsTZTeQ6NV1Rp9GT6sBE+FzTJeUO2dMkh6BqTCFR2WffNDRSr2gmN/jUy+LL/bkppRjMq1n3eJzCpomVrFKU882CJOJxHa0hwTs6LbEZh1GzOpkNqEgUorqfafYFheg2EXyY2DQK700EX5B/ywc6Pcf1MY7HJB5Wf1qxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669206; c=relaxed/simple; bh=gt7FClhwvs3MXi64ghUf0AKFzkmVf/aXt/WnhRE8M8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qqaIkoN3qjDQhDA6cRqXCn45l4mbr0MR3u8z8yV69wvXnNfy4+737MOLcq4tAZPXAAjBhXLEGO70YgvL9lzfgwZWxFBqllCYOydfvfOepSALKf7HlzCtsT7WiwGS8FwaU9F8Dqbq6Q3nNG5CxMXyX0tpw5vTpusBNvbX3lhbm5Y= 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=nRwMZmO9; arc=none smtp.client-ip=209.85.161.42 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="nRwMZmO9" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5f1e573f35bso1142881eaf.2 for ; Tue, 26 Nov 2024 17:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732669203; x=1733274003; 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=ChM6nVL0/dKyPT0QsYV6ZWG8CR1rZfDNM/cS2ZQC/44=; b=nRwMZmO9bNxQE7EOBoxtVJjGiyFfgKNZwQZeahXU3bh7o46U/S6PsGU5W0abhuLXAE BFeHwb+pFdbxex+Nyse+CTmSGez0my6jube0RcHr0yGyjzPYRhnGmr2AZZgxemriXH73 Qf42rvJfwP25dt9a3iGbwdkJPaAJuQwd9CzxL+StuUm5MGu64UE0LuUVDw+3Qs2X+iiS DwbUsUz5W1VV++dWFzykeI48CbxssR0xgs+soLRwyCIKIJeKjtw7+v3sbiwIW70JWT99 OVUYfX/wVLyV9Sy34/VATzbwDeC1nXhgSdwomya3wlGwndCn4fGgKsowwwHpJyIjwmJf RAfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732669203; x=1733274003; 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=ChM6nVL0/dKyPT0QsYV6ZWG8CR1rZfDNM/cS2ZQC/44=; b=seyp/wDWHPttcBG5tA8yNvUBpqoLXw8vbyxoMPRo7luScO11YzP7f1slW9fsAx7lMZ cHCDFA0ytcTaq4jl4O4vgEkygD35OKYlnXOaSp/QnXDewcMw34KDhiV7iZoNci437oeg NwEpLLxCXX1sONSNFREcQzoN3yO+7GGcl2gCR2wFRwQdG6dX+VYsR2Y0OsWZcpO5k5yW SKpK6BLYEJym4wKNSy0l10vlsy9zUqY8o6m7CjYMQ2IwG0d/+svwBW9dSoidYd9A5gyC FoWfWnB/3GaF3omPNs9hKwW374hfhMQxCV2L+X+O/IBuEqIDNGf4deazZGaGDGI/LS7P cVUA== X-Gm-Message-State: AOJu0Yy1u1XrbQRY+rWNSUIAA9j/qUnzEtZ67FlT+rnM9aV0zg65PR/W NtSm88A5OT2CKuoYRb4gLq0tbUVkeju8udsBsyzv6zJXEhROHajFBCYZgg== X-Gm-Gg: ASbGncss6ea5FVBaj6nIWlm0HISgkUshLPgE2WphKNF8jEfgJ5DmK6imQ3zAXA16QLr sPfvo068hPOILsqzfT8LBtqU8qr8O57eW1t4LvNwylf0s9eWpM+uQYcqp5lqe2hc17P1+n/XXC8 wbbaHqtWsDUQqc7E0K9/ZGt4nKDksaSv4D54noW31QgeDcHihQEoQPTKdeg9R4KjmwtFOgB5NJD mf4uFfdQ5WL1Utkpv7otmW2vHSkOSPlQSBNeEFZlCJ/XQ+uXhIZUL//0A== X-Google-Smtp-Source: AGHT+IFFjVCOKmI0oxRRhsMTXrPtXPgZ3dzq7NfI++4cRX8rhDjbo8eLb9U8PJkqXwPnu1dxzpg2Yg== X-Received: by 2002:a05:6830:441e:b0:71d:625e:cf2c with SMTP id 46e09a7af769-71d65cbca86mr1334826a34.17.1732669203420; Tue, 26 Nov 2024 17:00:03 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71c0378d26esm3316643a34.31.2024.11.26.17.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 17:00:02 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH v2 2/4] bundle: support fsck message configuration Date: Tue, 26 Nov 2024 18:57:05 -0600 Message-ID: <20241127005707.319881-3-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127005707.319881-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> <20241127005707.319881-1-jltobler@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If the `VERIFY_BUNDLE_FLAG` is set during `unbundle()`, the git-index-pack(1) spawned is configured with the `--fsck-options` flag to perform fsck verification. With this flag enabled, there is not a way to configure fsck message severity though. Extend the `unbundle_opts` type to store fsck message severity configuration and update `unbundle()` to conditionally append it to the `--fsck-objects` flag if provided. This enables `unbundle()` call sites to support optionally setting the severity for specific fsck messages. Signed-off-by: Justin Tobler --- bundle.c | 13 +++++++------ bundle.h | 7 +++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bundle.c b/bundle.c index 485033ea3f..4e53ddfca2 100644 --- a/bundle.c +++ b/bundle.c @@ -631,12 +631,12 @@ int unbundle(struct repository *r, struct bundle_header *header, struct unbundle_opts *opts) { struct child_process ip = CHILD_PROCESS_INIT; - enum verify_bundle_flags flags = 0; + struct unbundle_opts opts_fallback = { 0 }; - if (opts) - flags = opts->flags; + if (!opts) + opts = &opts_fallback; - if (verify_bundle(r, header, flags)) + if (verify_bundle(r, header, opts->flags)) return -1; strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL); @@ -645,8 +645,9 @@ 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) - strvec_push(&ip.args, "--fsck-objects"); + if (opts->flags & VERIFY_BUNDLE_FSCK) + 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 6a09cc7bfb..df17326b09 100644 --- a/bundle.h +++ b/bundle.h @@ -41,6 +41,13 @@ int verify_bundle(struct repository *r, struct bundle_header *header, struct unbundle_opts { enum verify_bundle_flags flags; + /** + * fsck_msg_types may optionally contain fsck message severity + * configuration. If present, this configuration gets directly appended + * to a '--fsck-objects' option and therefore must be prefixed with '='. + * (E.g. "=missingEmail=ignore,gitmodulesUrl=ignore") + */ + const char *fsck_msg_types; }; /** From patchwork Wed Nov 27 00:57:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13886468 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) (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 7E577C2F2 for ; Wed, 27 Nov 2024 01:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669208; cv=none; b=Rvpe7HwFqoo0N3NeTof/8eS6ITndj4AeSSvd4jmRZ9OkZd3n4m4Cgg/3X1vuWufWbKNQzkovViuz4FBwB+9OYlVovqzidO9srJNSe47YYGxQ//oocPHdN3ykfHzC3JSW92+U9kL3LEgePvS4PhAWPCq6BAApYkpyHNDeL4YW7gQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669208; c=relaxed/simple; bh=X2VaIaMntmc9VU9b69QPWjhDdFX5rBtojjEasFi8VF8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iCrloBhqDFFg7o5I17a4f96E78/TlX7dOcOakqaeY24Aq4HVDrX1VbmDx0m3g1YBRs3SsQDNhT2g+hHMQsX1siVMxsNNLDDWAUy/SuJyRm09gCoLPg2yeS+9pitiF78eUfnNHwkXC9WEiwfmKHU2elPRHrQIE98m+SlvTpvYWu0= 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=NNgvH+dc; arc=none smtp.client-ip=209.85.160.53 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="NNgvH+dc" Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-296252514c2so5806462fac.3 for ; Tue, 26 Nov 2024 17:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732669205; x=1733274005; 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=erUhl5uuI4TnuCgs3xeNSVatBb9LC7OvXAhOmedCR3Q=; b=NNgvH+dcTKMxw082zNd16Zwb+UpYVt5+dnQvVziMYmy+XxBeXvmWEliJRtLlOppT4q xZBVDaFdzK+PwKBAvdQndIBR6hm8QBzs+itqCOIeD+MDsZawNj0YgLZAqcTxyCH2irYs gzPPIl1qBmrVWUc46tV9nfItHRHCcFa5frPgNe3xm7L9DJCC2nkxXdALtA7XqmCIdR8Q OS5goDIWp4P5dSl/BnHjIxRaK/oJLJ23974lEYWlUhWt5hpTa+ln86+SW6bw+nTykxa0 PCAt5p2k8noDAFIQG3xBCDgIB++71L8926DFI1hmMeH6K+D0JEjmkaQhClNKvdMPr4lr XofA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732669205; x=1733274005; 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=erUhl5uuI4TnuCgs3xeNSVatBb9LC7OvXAhOmedCR3Q=; b=oK1XVSlKQjo4b3a9xtATf0DnWFFVgzKAVrFT7I4wWYiLEVC4nRBJebq18wx4BbRsMh HCi08/bQWj28ZcdWulr7qHs6Y4chgHvZ2abS9V/oZNQ5XYNsBLOtbq5w/22/N5X42/wc 0A+r5awctA2pn3owZVaJJnpYhk6f1lgdoEHhtx+m3auQDnZCmF1NsGTdKrFDQL15Zsz0 z7p0CBDGBxMQYuu1C1ZQmxTWs4XEQrD7Bzchi35+cMrZCWI4AKJKseZGUxEmHDlxYrAE npbDS3/uQpiSv9zFmHPTIgQQgWdI349M+eJswy1kyu5FsRrPniEdyrkAgbg+Mm5r+z4p ozjA== X-Gm-Message-State: AOJu0Yw7YIhRUfjLjrzPKUWtIBAxO9MQ9UM+Fxt190JzEokfv/uhrc+G svAglksFYFSgdFx2kcovQAxqw8gJE3Ktn01POiZeJpkokkzAv+sL/7y+/A== X-Gm-Gg: ASbGncs/RvsX3xbTYmwkLv8Td3q64xeuf3Uoc0DP610Raac2nbMfwDG/IRaHxhtzUUz +Zmq7lpQNPvn7MeRW6DtYYI28LAJeQVpkbeXqlFkboQDsLsTvL3r/VpBgWnigNsi2TtXbCcZWrZ NarWixUM2d4wRARl92Ya/1RElp1HqfXaWH0PIP4ZHi3QOHOfSeBduWip4f4dAmRAAexYeux9crI kuLFxjHMB7hPkRnYp2/cZYmS2rKYbAwjDYtDno7E0v6DyJEm7nmlNeXpw== X-Google-Smtp-Source: AGHT+IG4edtc4mjeb9c0Uc3l8H4dBVGNJSpXQX9mdQnQMQhfbTRwWveJxwbqkmOBwBR6CkXNdxV9qA== X-Received: by 2002:a05:6871:29b:b0:270:1fc6:18 with SMTP id 586e51a60fabf-29dc3fb72aemr942011fac.3.1732669205241; Tue, 26 Nov 2024 17:00:05 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71c0378d26esm3316643a34.31.2024.11.26.17.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 17:00:04 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH v2 3/4] fetch-pack: split out fsck config parsing Date: Tue, 26 Nov 2024 18:57:06 -0600 Message-ID: <20241127005707.319881-4-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127005707.319881-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> <20241127005707.319881-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. The same parsed fsck message severity configuration is also needed outside of fetch-pack. Instead of exposing/relying on the existing global state, split out the fsck config parsing logic into `fetch_pack_fsck_config()` and expose it. In a subsequent commit, this is used to provide fsck configuration when invoking `unbundle()`. Signed-off-by: Justin Tobler --- fetch-pack.c | 24 +++++++++++++++++------- fetch-pack.h | 3 +++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/fetch-pack.c b/fetch-pack.c index fe1fb3c1b7..e7d4f6e6e2 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_fsck_config(const char *var, const char *value, + struct strbuf *msg_types) { const char *msg_id; @@ -1867,8 +1867,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(msg_types, "%cskiplist=%s", + msg_types->len ? ',' : '=', path); free(path); return 0; } @@ -1877,14 +1877,24 @@ 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(msg_types, "%c%s=%s", + msg_types->len ? ',' : '=', msg_id, value); else warning("Skipping unknown msg id '%s'", msg_id); return 0; } - return git_default_config(var, value, ctx, cb); + return -1; +} + +static int fetch_pack_config_cb(const char *var, const char *value, + const struct config_context *ctx, void *cb) +{ + int ret = fetch_pack_fsck_config(var, value, &fsck_msg_types); + if (ret < 0) + return git_default_config(var, value, ctx, cb); + + return ret; } static void fetch_pack_config(void) diff --git a/fetch-pack.h b/fetch-pack.h index b5c579cdae..c667b6fbf3 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -106,4 +106,7 @@ int report_unmatched_refs(struct ref **sought, int nr_sought); */ int fetch_pack_fsck_objects(void); +int fetch_pack_fsck_config(const char *var, const char *value, + struct strbuf *msg_types); + #endif From patchwork Wed Nov 27 00:57:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Tobler X-Patchwork-Id: 13886469 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (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 C26468836 for ; Wed, 27 Nov 2024 01:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669211; cv=none; b=N9UOsPVW2nM0Fl8RSoXC7oxK1Rc+soKtBybVQFuu3DTDaqAvxKpKXSC0F9Lns+BllzFglH82AxYOhUCtok1W9r1QejGbyMFIGgReW0l1+HNMsLfm5vrpWvPj4rEZejtX1Sf1EyVjES+m8HpaqWf/D0bZ8wevftUJ02HK3bQRJ0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732669211; c=relaxed/simple; bh=xObzQfDoyEgRWr3dZn5y546B7zCUxVrFD81ljBrdn3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sQQaUPT/BQy/6nu2Vpzxt123doaDe7DY17DBrSqJQCAwUk2DxyNMPwYilzGOV07cLJ2n/tTBV6brDehYG0giG4d8Ss4dW3ZEv5vsU/b18OQXHgKaHePK4MD35237EinWZVae6bf3sH9nPmOWyjcQihkQRpgLY7Ln6FC5LRyeyWs= 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=ZbIy/amE; arc=none smtp.client-ip=209.85.160.43 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="ZbIy/amE" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-29666708da7so3858188fac.0 for ; Tue, 26 Nov 2024 17:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732669208; x=1733274008; 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=KHBTyPgDhTM/DitUp2D8gUcrwIPjvxWOgjSWHvi/NMo=; b=ZbIy/amEJ5qQOh3YsDsXA3mcZFE/7OvweeVCooCxaSNvLj43iPRu+JLkCUdUtnTzvM rK2L7k50QuNnNdsvzR3PVXbASVL+mY1iUAZrC2lC4uTHRk8QBl32UjPuPxXtdyut1YEO hosp/s7HntOo9Txrngvr8NzWgR7tE8QBuETOEzDA16go7uJC7rnwuqObbXKmeKdStg9V oBEeaBsQx34gTMCXZoDZlnDvMi+7Elev1752L7nr2hq9dIX+EQ8V4RQk0ywiJAQrKGTR z2eDSNoJMiIzttOe6eBZMCL3A9mjmPFNaOWmWxvWFeoP+EFtuXKAh/bDFDyCKd4Ja+U2 CGxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732669208; x=1733274008; 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=KHBTyPgDhTM/DitUp2D8gUcrwIPjvxWOgjSWHvi/NMo=; b=sOWfh1ch1cLePGNzIHhG8GovIlcH0Op3Qf+pn2sRu+mevkSvLtkUjYrYVM9uHy7bpy ReiaBn7a5dJCWxXdxQHtZaALTwF4lwDKIRscxDIOd4UH06/HKOjvb8oU/IRR0DMu/OnC +8GC4QjVTUuwyGgrauzeuwra3LbGby0nqXwAcffCTSOrFE/UQeVPvb28ZYAhrvTHNRfl lMh0MiAHMajx44tie/o/pe69SEtoL2Uvh8Br6QpsigJJY7nRsTGj/FG+5trJizDv03XN AvRO2CSD2ehn/1z4u7RZ/tICZkjlBLrwtKAhXukSARA92Pa03b8xmSzayWloPuQ0GZiI hHFA== X-Gm-Message-State: AOJu0YxCTatGisdln8f4Q4gzKQ540omns2THxyQu+YvSr5YXlUpzVqY1 SuX/2rrW0+fA44ySD7/Qi7hXEErCv38QWtc7yGVscvBx8zEd0BRRO08SoQ== X-Gm-Gg: ASbGncseTeKIMUc3CCSaFJXQps1NBysaFB+sEY5R9PmFeoayYI6KEzWaUeiyNQHnxA1 KpndHlqttI/u852PU847SdYQo1AIB0edz4lN7YrnwuJnXxlLqShhDLABscpK8AkpydMhKzbpnh6 mypxcOvEdIuo4MiIJQGMj2Lp8hmpCmgdoz1OVBBmBlwd9GWM6zy3pAnSlIty3UbIOjlEBmcGyZ9 HbgK9+Px8kjLw29XoPV949+PjlFyqcuy5+38Q9zTXNJurzgmrLt9i9ewA== X-Google-Smtp-Source: AGHT+IENr3LRY3NEyt9703Z1h5tuE3Es9IfhCzwjVrZb4rWlrDVHmdBzXKbtMtckLvaRnFhT7WVYxQ== X-Received: by 2002:a05:6870:eca4:b0:278:4f7:6058 with SMTP id 586e51a60fabf-29dc4303757mr565407fac.28.1732669208309; Tue, 26 Nov 2024 17:00:08 -0800 (PST) Received: from denethor.localdomain ([136.50.74.45]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71c0378d26esm3316643a34.31.2024.11.26.17.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 17:00:07 -0800 (PST) From: Justin Tobler To: git@vger.kernel.org Cc: Justin Tobler Subject: [PATCH v2 4/4] transport: propagate fsck configuration during bundle fetch Date: Tue, 26 Nov 2024 18:57:07 -0600 Message-ID: <20241127005707.319881-5-jltobler@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127005707.319881-1-jltobler@gmail.com> References: <20241121204119.1440773-1-jltobler@gmail.com> <20241127005707.319881-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 fsck config parsing from fetch-pack to populate fsck message severity configuration and wire it through to `unbundle()` to enable the same fsck verification as done through fetch-pack. Signed-off-by: Justin Tobler --- t/t5607-clone-bundle.sh | 7 +++++++ transport.c | 20 ++++++++++++++++++++ 2 files changed, 27 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 8536b14181..0209cac5e2 100644 --- a/transport.c +++ b/transport.c @@ -19,6 +19,7 @@ #include "branch.h" #include "url.h" #include "submodule.h" +#include "strbuf.h" #include "string-list.h" #include "oid-array.h" #include "sigchain.h" @@ -172,6 +173,19 @@ static struct ref *get_refs_from_bundle(struct transport *transport, return result; } +static int fetch_fsck_config_cb(const char *var, const char *value, + const struct config_context *ctx UNUSED, void *cb) +{ + struct strbuf *msg_types = cb; + int ret; + + ret = fetch_pack_fsck_config(var, value, msg_types); + if (ret < 0) + return 0; + + return ret; +} + static int fetch_refs_from_bundle(struct transport *transport, int nr_heads UNUSED, struct ref **to_fetch UNUSED) @@ -181,6 +195,7 @@ static int fetch_refs_from_bundle(struct transport *transport, }; struct bundle_transport_data *data = transport->data; struct strvec extra_index_pack_args = STRVEC_INIT; + struct strbuf msg_types = STRBUF_INIT; int ret; if (transport->progress) @@ -188,11 +203,16 @@ 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_fsck_config_cb, &msg_types); + opts.fsck_msg_types = 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(&msg_types); return ret; }