From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 634A516A395 for ; Wed, 5 Aug 2026 21:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785966544; cv=none; b=Bm9BW/pIzYpdwu6dOyGyw7AdodIsBeY4ISlOu9CJo9Ft2gazBf4AaduyME+LqbX84Da/btjfzD1utSmvX+TU+KDi2oEK3hzBK45xckwSiMyZ4aGO50hrWVseSqHxDNnySN5M6ZsYlzfWKpoK3+YaDxflG9Fyrd92vxZFyaQbaUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785966544; c=relaxed/simple; bh=cF+gPRsqhJECt+tX3JKLOvmZSbPqDfXBfD5/ra7aNDg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=qSsM9e7i7GN5qRkPG5AW7edol9w9KkFRb7HtmG6B+nzzfryj0Tu+BAprLfGhosocd+7+e/itBB/JqkUulrptcgO8HT8f+jjx7CvzgqoShUH9N310DOLO+qMneAUndboJ3Bkhmnus2yvxzE86+WfWXK0hzTbj3FKzWQuS1M0cBDE= 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=UB0AY+Mz; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ODq/Icgu; arc=none smtp.client-ip=202.12.124.148 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="UB0AY+Mz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ODq/Icgu" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 7D2B51D000ED; Wed, 5 Aug 2026 17:49:02 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-06.internal (MEProxy); Wed, 05 Aug 2026 17:49:02 -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=1785966542; x=1786052942; bh=rVGuwj3Cub Z2X5Jhj8rPyOJqsvM3jqEn1l4t2tucw64=; b=UB0AY+MzMjYI84IB0nEA95VGiY b9U5BUoc4/nSgIk70+1yRqd+F/S58vefI/qTVgcOj6ZjzBBB7NLjSfb12WbpLQDA hUIsiNFYVt26ldxm0L31Sk8xt13F8yuNnsr7W74C+On435E3x0kexD7yv7KULi0W dNzZG00uJbGm/m65WZRQgV0tOn/NMAfARp+0+HYTIencCgK3cJTdKcON1ceb4yPE GPrtJI3KEp+4VcLAr4jd8qvdWtx0t8yH0CBX1Kew1R0HV2avW91icR5Nl/u2Nju/ 9ijMVBGq7Qrl8K1vzYJB7u/NzdSYg1ffFv9mjgX/AIAF5uRi1z+xOtHKiMAg== 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= 1785966542; x=1786052942; bh=rVGuwj3CubZ2X5Jhj8rPyOJq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n0Fm6/XkTw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Aug 2026 17:49:01 -0400 (EDT) From: Junio C Hamano To: Tian Yuchen Cc: git@vger.kernel.org, Christian Couder , Ayush Chandekar , Olamide Caleb Bello Subject: Re: [PATCH 1/3] environment: simplify repository config getters In-Reply-To: <20260805115342.3939931-2-cat@malon.dev> (Tian Yuchen's message of "Wed, 5 Aug 2026 19:53:39 +0800") References: <20260805115342.3939931-1-cat@malon.dev> <20260805115342.3939931-2-cat@malon.dev> Date: Wed, 05 Aug 2026 14:49:00 -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 Tian Yuchen writes: > Drop unnecessary parentheses and NULL checks in repository config > getters. > > These getters are only used with non-NULL repositories, so the > extra checks do not match their current callers. OK. If repo MUST always be non-NULL, even when we haven't fully initialized them, then not punting on repo==NULL case like the original code is definitely an improvement. Looking good. > > Mentored-by: Christian Couder > Mentored-by: Ayush Chandekar > Mentored-by: Olamide Caleb Bello > Signed-off-by: Tian Yuchen > --- > environment.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/environment.c b/environment.c > index 76ee65e62b..f5628b6758 100644 > --- a/environment.c > +++ b/environment.c > @@ -119,23 +119,23 @@ int is_bare_repository(struct repository *repo) > > int repo_protect_ntfs(struct repository *repo) > { > - return (repo && repo->initialized) ? > - repo_config_values(repo)->protect_ntfs : > - PROTECT_NTFS_DEFAULT; > + return repo->initialized > + ? repo_config_values(repo)->protect_ntfs > + : PROTECT_NTFS_DEFAULT; > } > > int repo_protect_hfs(struct repository *repo) > { > - return (repo && repo->initialized) ? > - repo_config_values(repo)->protect_hfs : > - PROTECT_HFS_DEFAULT; > + return repo->initialized > + ? repo_config_values(repo)->protect_hfs > + : PROTECT_HFS_DEFAULT; > } > > int repo_ignore_case(struct repository *repo) > { > - return (repo && repo->initialized) ? > - repo_config_values(repo)->ignore_case : > - 0; > + return repo->initialized > + ? repo_config_values(repo)->ignore_case > + : 0; > } > > int repo_trust_executable_bit(struct repository *repo)