From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.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 9AA3D395D8E for ; Sat, 20 Jun 2026 15:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781968686; cv=none; b=SO8MY9Wiq0gL/vjGdlErvujvUBnrTX9sA6VMxEZIldWGq2nHyS60nPwKtdqORHxVJmCDcU+yfhPcfkybh8lKMHJGgDO6ZGKZa2/gm6OpciGvhLzJ+y4jB4c7/UUSra3CCJDpA7Lxdot9FzBpPt/L5d+KR64E5Ry95xbmtPnLEUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781968686; c=relaxed/simple; bh=A8mMw+VatQSyhFXAS+RYI46WFRgwh5Dn/fyhQM1/RH0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AS6vZcK8NLhJumVWA9d+WjzVknbBKsP3M0/riK4Ddbpm5p449xb/Xpo5mA0sVtsgKC1sLWkNKIoLiq/ZxOPe8Jv33/pidlpG5P7Yn+hi5ol6S1O91P/hMZ212f3BO8ZQ3g7Y1IHW6iajEmCSaPhY4ibEQp5d0s/iYI6iW92P1wM= 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=bKDJnMIw; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=YZDWqBWB; arc=none smtp.client-ip=103.168.172.149 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="bKDJnMIw"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="YZDWqBWB" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id D0FA5EC0169; Sat, 20 Jun 2026 11:18:03 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-07.internal (MEProxy); Sat, 20 Jun 2026 11:18: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=fm3; t=1781968683; x=1782055083; bh=R6MwaOUBXq I6cxq0wYh7j8ofoyadUJKkQUirU9+WdTU=; b=bKDJnMIwptDCk19Oe/ksVWxtYD yXZG1uIBuF4tH9UxuSEDszhYH20UPuhYByZqM4BHjHHTOiDm1Kqsb7sd6z9Un+GQ ormHfzwLUqYfBm5gl9dnPlV4fN5O0SppfhxVLubZDJoXH55pAavdsHJqgGbePR+N eAtOZEf1B5bA3Sx6ZxJorLwzLvp3onGl6jQ2CbN+fQf5hHNKHsgGl98AzzlmvSiF A7etAJUoTHkU4tVECrGSf3VYfKviMs4XwTJ2GxQ0dtk1Eef2euO1aCGzPiKkwPBe uUwd/7OkSBFmeBTMdzMA4eAhsNzIL2RPxeRDNB5xmg24iFLcXHCTZivX7inw== 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=fm1; t= 1781968683; x=1782055083; bh=R6MwaOUB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15YG4/OSEB4cDyVJqhyqOTsCzhDYRGxnGxN6wA X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 20 Jun 2026 11:18:03 -0400 (EDT) From: Junio C Hamano To: Tian Yuchen Cc: git@vger.kernel.org, Christian Couder , Ayush Chandekar , Olamide Caleb Bello Subject: Re: [PATCH] environment: use 'repo->initialized' for repo_protect_hfs() and repo_protect_ntfs() In-Reply-To: <20260620140957.667820-1-cat@malon.dev> (Tian Yuchen's message of "Sat, 20 Jun 2026 22:09:57 +0800") References: <20260620140957.667820-1-cat@malon.dev> Date: Sat, 20 Jun 2026 08:18: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: > To match how we refrain from calling repo_config_values() on an > uninitialized instance of a repository object in other two topics > that deal with ignore_case and trust_executable_bit, check the > repo->initialized bit instead of the repo->gitdir member. OK. > Base commit: 43192e7977f5f05138abcdb3212a3f87ab513bef This line does not belong here. Besides, you do not build directly on top of 'next', ever. > Mentored-by: Christian Couder > Mentored-by: Ayush Chandekar > Mentored-by: Olamide Caleb Bello > Signed-off-by: Tian Yuchen > --- > environment.c | 4 ++-- > environment.h | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) I'll queue the change directly on top of ty/move-protect-hfs-ntfs topic, which will be merged to 'next'. Thanks. > diff --git a/environment.c b/environment.c > index 6ee11e9fc8..8f0c1c4f25 100644 > --- a/environment.c > +++ b/environment.c > @@ -130,14 +130,14 @@ int is_bare_repository(struct repository *repo) > > int repo_protect_ntfs(struct repository *repo) > { > - return repo->gitdir ? > + return (repo && repo->initialized) ? > repo_config_values(repo)->protect_ntfs : > PROTECT_NTFS_DEFAULT; > } > > int repo_protect_hfs(struct repository *repo) > { > - return repo->gitdir ? > + return (repo && repo->initialized) ? > repo_config_values(repo)->protect_hfs : > PROTECT_HFS_DEFAULT; > } > diff --git a/environment.h b/environment.h > index d188955f5b..8aaedcfea3 100644 > --- a/environment.h > +++ b/environment.h > @@ -137,8 +137,8 @@ int git_default_core_config(const char *var, const char *value, > > /* > * Getters for the `protect_hfs` and `protect_ntfs` fields of `struct repo_config_values`. > - * They check `repo->gitdir` to prevent calling repo_config_values() > - * before the configuration is loaded or in bare environments. > + * They check `repo->initialized` to prevent calling `repo_config_values()` > + * before the repository setup is fully complete or in non-git environments. > */ > int repo_protect_hfs(struct repository *repo); > int repo_protect_ntfs(struct repository *repo);