From patchwork Wed Feb 26 15:24:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13992639 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C84F31ADC8F for ; Wed, 26 Feb 2025 15:24:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740583482; cv=none; b=tLl6+mRlO5sEsYGZSJsqxvPsa2fZh33nJDzzAqPjKcS/dxWLWcMpdyqxNALQevFA62o0LiSWnG6Q1XGNo4LYiAkbjwPE8oD6mVjHr4jPl2Cfq6VF6Au2Z5Q0KyTYPyLzMaOOwCG+0iIdL2tDRdlmNiZF/vHIJk9GMz8RpRoI+qY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740583482; c=relaxed/simple; bh=79S7bicnntX92UFevwHXRIMhVl8PZEN4X+QnnLkWVwM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F9JiVTqX4wdHz9AZ6UWYfo9P+Yb/PixcTYmW6kVzrLhCKo7ihrAiDheUBKtIhSzZPTcQieiWJlcvvGBhWP0Gex8tpZ1kwVD86t+bwh3SIyfYFvtgoGBqF5DXmoLLkOHkBwuTHTQPavOJe9/3yX3+of9G4JW9ncj9f7lZhIBbfuc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=cbCyAwGq; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=iQqwvA2h; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="cbCyAwGq"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="iQqwvA2h" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id BE17B114017D; Wed, 26 Feb 2025 10:24:38 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 26 Feb 2025 10:24:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1740583478; x=1740669878; bh=LXEIuKIpuAgqh5l8fgz9aqXZYSd68CxBZfvx8j2kZ9k=; b= cbCyAwGqe6p4iHmCdBqbRnjRcV/eY5p7yCa9+Vql594YNrUIkLRo40erJzcvLLkL bnJaxuWyrE5TPBLzgX7IrMhxrXq4aj43nRIKEqacTr7EjlQLerRlFmaXcDtwivKh +ESx/6FiIFsH90LJI/tTCfVMYUHlOk8WpNG52XwIvCd1LYYqPKl6uWFzfXrxosyM 1ksnskG7tN7hZS2zTpMP+dXMnX9XT7vf3lmpN7tbH3sgHQwiIaNRQAlIoVoUvS0u u+Gq2LbPkD/o1q3yjBISEZ90Al0HqdKBab0aXXS9pxPwE5jCXJ+Oe/v6B09YP/5I EgHzY5dWzNofmi+YivxsSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1740583478; x= 1740669878; bh=LXEIuKIpuAgqh5l8fgz9aqXZYSd68CxBZfvx8j2kZ9k=; b=i QqwvA2hxSJJAWidqyx1o/4EBqHWprxxPGi53qerTFpu21z3TixT5wFrTaT4Ykhgg /AwTMzzCN7obqYwBBWu93t6mW1EQTHPRT2T0gnF+Q5NNalDn1URdgFpOUqR1WrWa 5t0QmWmnZZPZFFlfw+ZDm0KfmkyUUtcs4WlDhabktfuxN5q4co+fLvWYGwLsMLas CX1KoqOjCGn2nQeBo3UXVn6MhySK2b+PIphlcABkpReBs+xcdsl+PqxbskR6BfyS YzYAS8gtNkvmTDSkmu2vI7yOwZhom9c8Tz48mNBbecNeHcitEu1klgMBZpeXJe5I +8Wke5/zrS/+lCuZdpAQA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekgeelfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepgedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvddtvdehsehugihprdguvgdprhgtphhtthhope hsthholhgvvgesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtshhtvghrsehpohgs ohigrdgtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 26 Feb 2025 10:24:37 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 3e8a360d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 26 Feb 2025 15:24:33 +0000 (UTC) From: Patrick Steinhardt Date: Wed, 26 Feb 2025 16:24:26 +0100 Subject: [PATCH 1/6] reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250226-pks-maintenance-reflog-expire-v1-1-a1204a814952@pks.im> References: <20250226-pks-maintenance-reflog-expire-v1-0-a1204a814952@pks.im> In-Reply-To: <20250226-pks-maintenance-reflog-expire-v1-0-a1204a814952@pks.im> To: git@vger.kernel.org Cc: Markus Gerstel <2025@uxp.de>, Junio C Hamano , Derrick Stolee X-Mailer: b4 0.14.2 We're about to expose `struct cmd_reflog_expire_cb` via "reflog.h" so that we can also use this structure in "builtin/gc.c". Once we make it accessible to a wider scope though it becomes awkwardly named, as it isn't only useful in the context of a callback. Instead, the function is containing all kinds of options relevant to whether or not a reflog entry should be expired. Rename the structure to `reflog_expire_options` to prepare for this. Signed-off-by: Patrick Steinhardt --- builtin/reflog.c | 38 +++++++++++++++++++------------------- reflog.c | 30 +++++++++++++++--------------- reflog.h | 4 ++-- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/builtin/reflog.c b/builtin/reflog.c index 95f264989bb..dee49881d32 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -168,7 +168,7 @@ static int reflog_expire_config(const char *var, const char *value, return 0; } -static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, const char *ref) +static void set_reflog_expiry_param(struct reflog_expire_options *cb, const char *ref) { struct reflog_expire_cfg *ent; @@ -207,15 +207,15 @@ static int expire_unreachable_callback(const struct option *opt, const char *arg, int unset) { - struct cmd_reflog_expire_cb *cmd = opt->value; + struct reflog_expire_options *opts = opt->value; BUG_ON_OPT_NEG(unset); - if (parse_expiry_date(arg, &cmd->expire_unreachable)) + if (parse_expiry_date(arg, &opts->expire_unreachable)) die(_("invalid timestamp '%s' given to '--%s'"), arg, opt->long_name); - cmd->explicit_expiry |= EXPIRE_UNREACH; + opts->explicit_expiry |= EXPIRE_UNREACH; return 0; } @@ -223,15 +223,15 @@ static int expire_total_callback(const struct option *opt, const char *arg, int unset) { - struct cmd_reflog_expire_cb *cmd = opt->value; + struct reflog_expire_options *opts = opt->value; BUG_ON_OPT_NEG(unset); - if (parse_expiry_date(arg, &cmd->expire_total)) + if (parse_expiry_date(arg, &opts->expire_total)) die(_("invalid timestamp '%s' given to '--%s'"), arg, opt->long_name); - cmd->explicit_expiry |= EXPIRE_TOTAL; + opts->explicit_expiry |= EXPIRE_TOTAL; return 0; } @@ -276,7 +276,7 @@ static int cmd_reflog_list(int argc, const char **argv, const char *prefix, static int cmd_reflog_expire(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { - struct cmd_reflog_expire_cb cmd = { 0 }; + struct reflog_expire_options opts = { 0 }; timestamp_t now = time(NULL); int i, status, do_all, single_worktree = 0; unsigned int flags = 0; @@ -292,15 +292,15 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix, N_("update the reference to the value of the top reflog entry"), EXPIRE_REFLOGS_UPDATE_REF), OPT_BOOL(0, "verbose", &verbose, N_("print extra information on screen")), - OPT_CALLBACK_F(0, "expire", &cmd, N_("timestamp"), + OPT_CALLBACK_F(0, "expire", &opts, N_("timestamp"), N_("prune entries older than the specified time"), PARSE_OPT_NONEG, expire_total_callback), - OPT_CALLBACK_F(0, "expire-unreachable", &cmd, N_("timestamp"), + OPT_CALLBACK_F(0, "expire-unreachable", &opts, N_("timestamp"), N_("prune entries older than