From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS54825 139.178.88.0/22 X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A116B1F44D for ; Thu, 18 Apr 2024 05:48:25 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=sJ+deU6D; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=U4etRpjX; dkim-atps=neutral Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CA2C428371B for ; Thu, 18 Apr 2024 05:48:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA23D58119; Thu, 18 Apr 2024 05:48:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="sJ+deU6D"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="U4etRpjX" Received: from wfhigh5-smtp.messagingengine.com (wfhigh5-smtp.messagingengine.com [64.147.123.156]) (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 9719253AC for ; Thu, 18 Apr 2024 05:48:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.156 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713419296; cv=none; b=EgHTYzHb1xRQmJcNUhG/leOozYB1PvBRsRBKOUChf1y2eeSOGR9CqAliqZJaZ0zqgWkdsebfb5Kp6733djero1hudYu0VbFubfl9T4cTmGfRlJWbYVP3WRBGswTOdw0tdziP1flbcDe1sVKfb5Rvu6BybMLbKfySljUZL4fV7f8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713419296; c=relaxed/simple; bh=t+ln3pMalIpXgetm1WD7APZrbrNuOkPAkWvBSCPPLEs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fi7WXrhkYSt3pGrNIon2zALDEc05H1MhNNT05XNIgSCp7b2JkGwETIPX9O61PMlB81iUxqqGy5bDzQjcH88OvwnNEQ+kbHF02+6/aVwLs8OSs22uvLtk04+N46m+rf3AwergDuVWeKeKKNP4jHhUmk7ZRHnl6d6omiFZ6s4dbEM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none 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=sJ+deU6D; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=U4etRpjX; arc=none smtp.client-ip=64.147.123.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id 786721800171; Thu, 18 Apr 2024 01:48:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 18 Apr 2024 01:48:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :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=fm3; t=1713419292; x=1713505692; bh=u/0owMAo2Z /HCSFH1LC07Psv9naVagZFVNFIuxyGxm0=; b=sJ+deU6D2tlShvvHFd5yZFBq6t 6axFuV8iy3UsbGfZV71noncjaXEb+51GbNLuWm5+TB6kQUPQlUTScMAQgezMqAU0 gkQAuIDWtYD/VTso64y9yOpIbXk8GTCLj8KHRQymWzyJYkDgjGlyBZeHcc7cM9d5 vkwjG/++9BsJVcCnTHcC5L5zaSWLbDRPrr+IWxKWZBRnsi/cNmbFlGzFsQScToX9 RlsrtOZhCUksKEAxZ28JhIc55AAo6LoQ2rLioYsvYKMpDNtpP3W4bWEiki4UH4f5 6I5I9icR78fr7nxYairXJ4AlcO5ILMW9mI4oA5OwqHWs1J/mMdA979vX1Kyg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1713419292; x=1713505692; bh=u/0owMAo2Z/HCSFH1LC07Psv9naV agZFVNFIuxyGxm0=; b=U4etRpjXGyo3HmQVYMTygAyPSBMt5BKhyN9fn/dTPoe/ ep5ezDnm1XJ5M2cYd4lTt7YemDFa1Ie6UySp50+rJwlGv1kJu/eZxcHqjrbREUK+ Ue3MIzO/4p/obccI6eJGzdYuYqwBgpnmB3gsi1uRhGZM4SjQvgq8kz8V2Zvkn2Fh H3qC6segdL6eTfEzHyBQHq26iQM3EKrEga67VNwWmhs/bQmplqRPhv60GFIXatV6 Svt2RqOJwjU/VgXZb0pyZmA8opaNk5K/JJFWbRC5yFUZHiRUw8hzZkw3Ao7Spg7M oL59bBD6hF1xvdr/7Q6hGRD9JqraB9/UbQSfRPdNWw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudejledguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrght rhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtth gvrhhnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleff teenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpsh esphhkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Apr 2024 01:48:11 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 26f37feb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 18 Apr 2024 05:47:46 +0000 (UTC) Date: Thu, 18 Apr 2024 07:48:08 +0200 From: Patrick Steinhardt To: Junio C Hamano Cc: git@vger.kernel.org, Derrick Stolee Subject: Re: [PATCH 1/2] run-command: introduce function to prepare auto-maintenance process Message-ID: References: <929b6bfa08132523ee97f5adc376c3600f779a99.1713334241.git.ps@pks.im> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PY8O+gvmCHbSkIcB" Content-Disposition: inline In-Reply-To: --PY8O+gvmCHbSkIcB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 17, 2024 at 08:53:25AM -0700, Junio C Hamano wrote: > Patrick Steinhardt writes: >=20 > > The `run_auto_maintenance()` function is responsible for spawning a new > > `git maintenance run --auto` process. To do so, it sets up the `sturct > > child_process` and then runs it by executing `run_command()` directly. > > This is rather inflexible in case callers want to modify the child > > process somewhat, e.g. to redirect stderr or stdout. > > > > Introduce a new `prepare_auto_maintenance()` function to plug this gap. >=20 > I guess the mention of "inflexible" and "redirection" above refers > to some incompatibile behaviour we would introduce if we just > replaced the manual spawning of "gc --auto" with a call to > run_auto_maintenance(), but I would have expected that will be > solved by making the interface to run_auto_maintenance() richer, not > forcing the callers that would want to deviate from the norm to > write the second half of the run_auto_maintenance() themselves. >=20 > > +int run_auto_maintenance(int quiet) > > +{ > > + struct child_process maint =3D CHILD_PROCESS_INIT; > > + if (!prepare_auto_maintenance(quiet, &maint)) > > + return 0; > > return run_command(&maint); > > } >=20 > But given that the "second half" is to just call run_command() on > the prepared child control structure, it is probably not a huge > deal. It just felt somewhat an uneven API surface that 'quiet' can > be controlled with just a single bit and doing anything more than > that would require the caller to go into the structure to tweak. >=20 > Will queue. Thanks. git-receive-pack(1) needs to do some magic with file descriptors and needs to copy output of the command to the sideband. I first thought about extending `run_auto_maintenance()` to support this, but found it to be messy as this really is quite a specific usecase. So I figured that prepping the `struct child_process` like this is the nicer way to approach it. Thanks. Patrick --PY8O+gvmCHbSkIcB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAmYgtBgACgkQVbJhu7ck PpRhoA/+LlbgR08albSJABNFEj6GvE9NR/bVLSB1tuyByT2lBdxG+3Mg+0ucxwtV mpkzlzPW2MAVomdV0aFTBvVa5vWp8RI5NZp2LSOmDrH5q/4nJLOdmADsCGEkZljE r0QNF1RQj/zy9HgM/6VIVq+4JdsWUs/v4tbiX75KzcxqD6q4Q/7lfBAnpdg6C8In 1NoyyI4WE6DMpjiTpp76PvMuOhXId/mfNM2q2+Ww1HiFRAqdw+alSxTGtVEwU5bp VjV0oPXL+Pvlls5laYwZoi57ZAVjuvbdbouyVdC0SeRkwKoyP6Lw6dx9mHcuqA/w yah2jbRUgMuCwKIoYslxa4+V4E++2YtO4Nuz2Y5sy27Li3uhdCYkKsXLq658zyVz yFp70dptxhkLjO5U6VQSwUm5XIsLcUqU/EurHHafFDG2yVu/tQ0K+r5a7Sy23qFJ xR+Yg9t03siQbgTUgYVO6OKrkl4y2d2uh7q5kTpL8UNwg+2AimcNUREU+PPtsHGT TAwHbpae8aLyV0slCfe/GK+8j9QvZ/hC+fUix/l5bC4G0mEFszilWb7VQbYXKlV2 NCfAVcIXaAGokyF3AuoAgGmmWQGB/GnX91QfMnDgTTi9Jvmv9ix6EBCVIQvtWaRU DztaeocgStRnSAgGx5fS6/bs8H7UCazxFmisGsEddteGSlFmh+Y= =Lpfj -----END PGP SIGNATURE----- --PY8O+gvmCHbSkIcB--