From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b1-smtp.messagingengine.com (fout-b1-smtp.messagingengine.com [202.12.124.144]) (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 0AEB415533F for ; Tue, 13 May 2025 15:47:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747151258; cv=none; b=BCav4VuetEICmKT5pGY/ur7vOhN9w7jNF4Dxa0QFL+lcOkaFtBeBmMFH8EkkkJJqDe8niCGlPYL/3BDJLAqPVZqeoBEFZjeeS1pWqx+i1gRZz13bfP5+WSZC/p3ra7Zlq/yLDzpA45zGWWhFwb80yROC4f7w5TZPdG+x7KNBM1M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747151258; c=relaxed/simple; bh=P7JWCIjN9kBDrh8LjTH/mK4JQwjgZtGr0xkTd364W20=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=NPi4yBbSdBZSSWMuMj9UHfzj7H4sRrFKN8j2AYSFF0vX9cd7x59SzhU9MOO2GpNVwDVrPgzxRweMduRHXm+ahg9AMzRJe6WCUgAvOkhzHivT+pLWXUUNrYDE5nJeI3Oe92K9UuilzH99Wvrp7FLq6uAoON/MvqQPPyc4j257u70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=pzNUooN8; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TxgF/0xr; arc=none smtp.client-ip=202.12.124.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="pzNUooN8"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TxgF/0xr" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id EA7FF114014D; Tue, 13 May 2025 11:47:34 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-04.internal (MEProxy); Tue, 13 May 2025 11:47:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; 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=fm2; t=1747151254; x=1747237654; bh=qPf09w7v9o D6a3NXI06v5Vr/k6cZUALNnSeQujwefVQ=; b=pzNUooN8rFZE1kKsnkBViMEC0g rtm4p/eMJKm6Ih1ZX/3wqwHIEipVGclZVpl0TF31h0bxIqMoLwgC6KJNdxnm6oKS UvRjh85wkd+e8SXbIqwT4nos+GOJ+5RxpLTZThap3hrcH/djlZsXtGBacvba0nCy zkJ7rNsdnQa07H3P4wP4eZKueAWRJPEU7Qu5kWut0hwTWeMKewGnQe6f/xvVAqlK u6DL9Pknp9YDT8aqsBjKQA9VdLqtQ92G9ye+ozwRioh6OJiQk+6WmUCmDBN0wq9Z Oc+ciRewi+puJduLwMJiclsgSbYiWsLssMuuDDG/RDlWtMVLIINVhpiT8qMQ== 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-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1747151254; x=1747237654; bh=qPf09w7v9oD6a3NXI06v5Vr/k6cZUALNnSe QujwefVQ=; b=TxgF/0xry821XTkIml5bp0E5tJ6bvT7rx80qDGgWiOuQabZfi4+ VnkmPg02hXGdtAIL4dWcABKT2/TFDyai0isPk/6ba6LvBxI7qYQsYF5Kq8ZUgRGb gnkCnRvkoNPj9cw32Co5LdXoRW1fpEOJUETM5Zwnx4lnSbsy9wXVtM5yUYgZagTG 1pLHkj6C8rvPGWRmpkJR9ji1K49tpowNiHyJdLC0eW5WSmuAl/Or4oLhpHBp94jU YjqvtR/kx/Wv6OrOpSjDhCERHNUYqsVxDjsjj1ZFsW3PqI8uUjj2OED8qkH+uJCa q7RajxHSW+N89BAnbAw7B93KGZNGnY/z+Dw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdeghedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkfgggtgesthdtredttder tdenucfhrhhomheplfhunhhiohcuvecujfgrmhgrnhhouceoghhithhsthgvrhesphhosg hogidrtghomheqnecuggftrfgrthhtvghrnhepfeevteetjeehueegffelvdetieevffeu feejleeuffetiefggfeftdfhfeeigeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepghhithhsthgvrhesphhosghogidrtghomhdpnhgspghr tghpthhtohepkedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhhihhllhhiph drfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtghhithhgrggu ghgvthesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtohepkhhrihhsthhofhhfvghrhhgruhhgshgsrghkkhesfhgr shhtmhgrihhlrdgtohhmpdhrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvg gtohdrtghomhdprhgtphhtthhopegthhhrihhsthhirghnrdgtohhuuggvrhesghhmrghi lhdrtghomhdprhgtphhtthhopehlvghonhhmihgthhgrlhgrkheisehgmhgrihhlrdgtoh hmpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 13 May 2025 11:47:34 -0400 (EDT) From: Junio C Hamano To: Phillip Wood Cc: Leon Michalak via GitGitGadget , git@vger.kernel.org, Kristoffer Haugsbakk , Eric Sunshine , Christian Couder , Leon Michalak Subject: Re: [PATCH v2 3/4] add-patch: respect diff.context configuration In-Reply-To: (Phillip Wood's message of "Tue, 13 May 2025 14:52:25 +0100") References: Date: Tue, 13 May 2025 08:47:32 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Phillip Wood writes: > Hi Leon > > On 10/05/2025 14:46, Leon Michalak via GitGitGadget wrote: >> From: Leon Michalak >> Various builtins that use add-patch infrastructure do not respect >> the user's diff.context and diff.interHunkContext file configurations. > > We could expand this slightly by adding > > This is because the plumbing commands used by "git add -p" to generate > the diff do not read those config settings. Fix this by reading the > config before generating the patch and passing it along to the diff > command with the "-U" and "--inter-hunk-context" command-line options. > >> This patch fixes this inconsistency. >> Signed-off-by: Leon Michalak >> --- > >> @@ -78,6 +82,19 @@ void init_add_i_state(struct add_i_state *s, struct repository *r) >> repo_config_get_string(r, "diff.algorithm", >> &s->interactive_diff_algorithm); >> + if (!repo_config_get_int(r, "diff.context", &context)) { >> + if (context < 0) >> + die(_("%s cannot be negative"), "diff.context"); >> + else >> + s->context = context; >> + }; >> + if (!repo_config_get_int(r, "diff.interHunkContext", &interhunkcontext)) { >> + if (interhunkcontext < 0) >> + die(_("%s cannot be negative"), "diff.interHunkContext"); >> + else >> + s->interhunkcontext = interhunkcontext; >> + }; > > Thanks for changing this. This iteration of the code changes looks good Lose the ';' (semicolon) after closing {brace}s. This is C; you do not need an empty statement after a {block}. Everything in your review I am very happy to see. Thanks for giving a great review.