From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 AD16C348C46 for ; Fri, 17 Jul 2026 16:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784304066; cv=none; b=mNNA0T2qALKbhTYEQzxHR2pAgdIcESqM/qTKloIfCRRubq5YSMIEtRDO5jdHJ2pJ3MxtOM6lEUyg9Ij9hHmrpCnT7X5oDkXDsYUO696sZSIdHo3aZ+RAyI+ieI5yLrPA4AQsCo/JV2QHskXfn9pm14tkeLlONoET/QKLd6qY89g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784304066; c=relaxed/simple; bh=/zZDXSO5i1wdVgc2EY8+C0x48/SThfdWHL/GjelkTH8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=EdQFujk6BTsIZP3oxTkw0wQ0QO+I7IGHlmeonO2iRhijqmYcTx9Lm96doKhCsgZa0uRx6HZ4KbgGJkFjQSUuyCktTQ3PHvMxG85O/ypRyfpEaDh3GbcCyzjbm3TrSYHYwUrxGIyHqq4iLo5S5KLgKbhi8UEXyRhpc+eFGw+GzVQ= 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=R/GV4X7T; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=lswcd0rY; arc=none smtp.client-ip=103.168.172.153 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="R/GV4X7T"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lswcd0rY" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id E18351400090; Fri, 17 Jul 2026 12:01:03 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-07.internal (MEProxy); Fri, 17 Jul 2026 12:01:03 -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=fm1; t=1784304063; x=1784390463; bh=KnNfiPdDni kVaiRRYBYO1iHFS7DC7uXCJz/buerhlwk=; b=R/GV4X7TXb9RWpqOwi39CR9xhK Jvj98IVECmk5cYoPu8X71OY6ZYSNo79UEtuE07upQf7/Aexq2YltjxNfoMIKXpoA hrTq7zzyrBggIYsT6xKq2cnkfv21mEaifK8dTup6x6llo36HO74sASPIBTjwpcw/ BF+o82jJRMGc8GPAd7h6L9TkDrfCDPx6IOUrCTdgSFpxTdwW5Rsq/qrrRJvnU0xn x9eEIdqW/Qjoo1umJWcuRUi0UPlJy75C/psPlxdD1Y2/YAg26ubH8IC7uGc2OsFt ot1ULNASSod/vWr8dnzoA7vK5oPMp12YwJmySATOMWphA3Vc0QY1tpwveSUw== 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=fm2; t= 1784304063; x=1784390463; bh=KnNfiPdDnikVaiRRYBYO1i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cA X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Jul 2026 12:01:02 -0400 (EDT) From: Junio C Hamano To: Tian Yuchen Cc: git@vger.kernel.org, ps@pks.im, Christian Couder , Ayush Chandekar , Olamide Caleb Bello Subject: Re: [PATCH v7 3/4] environment: move trust_executable_bit into repo_config_values In-Reply-To: <20260717063559.1633567-4-cat@malon.dev> (Tian Yuchen's message of "Fri, 17 Jul 2026 14:35:58 +0800") References: <20260716084941.1101918-1-cat@malon.dev> <20260717063559.1633567-1-cat@malon.dev> <20260717063559.1633567-4-cat@malon.dev> Date: Fri, 17 Jul 2026 09:01:01 -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: > diff --git a/environment.c b/environment.c > index fc3ed8bb1c..75069a884d 100644 > --- a/environment.c > +++ b/environment.c > @@ -41,7 +41,6 @@ > static int pack_compression_seen; > static int zlib_compression_seen; > > -int trust_executable_bit = 1; > int trust_ctime = 1; > int check_stat = 1; > int has_symlinks = 1; > @@ -142,6 +141,13 @@ int is_bare_repository(void) > return is_bare_repository_cfg && !repo_get_work_tree(the_repository); > } > > +int repo_trust_executable_bit(struct repository *repo) > +{ > + return repo->gitdir? > + repo_config_values(repo)->trust_executable_bit : > + 1; > +} > + > int have_git_dir(void) > { > return startup_info->have_repository Two comments. * Missing SP before '?'. It may be easier to read if it is written like this: return repo->gitdir ? repo_config_values(repo)->trust_executable_bit : 1; which more clearly highlights the ternary structure. If you tilt your head 90 degrees to the left, you can almost see the parse tree of the expression. * Does it make sense to protect against a NULL 'repo' case, as repo_protect_ntfs() and repo_protect_hfs() helpers do? Or is it better to crash loudly with a segfault to let the developer know they have a bug to fix? I lean toward the latter myself, and if we go that route, we should probably stop using 'repo && repo->gitdir' elsewhere, rather than sweeping the problem under the rug with defensive checks.