Article View: linux.kernel.git
Article #1413[PATCH 3/4] environment: move core_eol into repo_config_values
From: Aniket Gupta
Date: Sat, 24 Oct 2026 22:00
Date: Sat, 24 Oct 2026 22:00
175 lines
15819 bytes
15819 bytes
The global variable 'core_eol' holds the value of the 'core.eol'
configuration, which sets the line ending used for files that are
converted to the working tree format. Move it into 'struct
repo_config_values' to continue the libification effort.
As with 'enum auto_crlf', moving 'enum eol' to 'convert.h' would
introduce a circular dependency chain:
convert.h -> hash.h -> repository.h -> environment.h.
Therefore, keep the enum definition in 'environment.h' next to the
other ones, under the existing NEEDSWORK comment. Initialize the
per-repository value to its default in 'repo_config_values_init()'.
Modify the configuration parsing in environment.c to update the
per-repository structure directly, and introduce the getter
'repo_core_eol()' to read the value in 'convert.c'.
Signed-off-by: Aniket Gupta <aniketgupta3001@gmail.com>
---
convert.c | 6 +++---
convert.h | 12 ------------
environment.c | 17 ++++++++++++-----
environment.h | 14 ++++++++++++++
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/convert.c b/convert.c
index 7c7fdd4b2d..1d4e8a246b 100644
--- a/convert.c
+++ b/convert.c
@@ -164,9 +164,9 @@ static int text_eol_is_crlf(struct repository *repo)
return 1;
else if (repo_auto_crlf(repo) == AUTO_CRLF_INPUT)
return 0;
- if (core_eol == EOL_CRLF)
+ if (repo_core_eol(repo) == EOL_CRLF)
return 1;
- if (core_eol == EOL_UNSET && EOL_NATIVE == EOL_CRLF)
+ if (repo_core_eol(repo) == EOL_UNSET && EOL_NATIVE == EOL_CRLF)
return 1;
return 0;
}
@@ -192,7 +192,7 @@ static enum eol output_eol(struct repository *repo,
return text_eol_is_crlf(repo) ? EOL_CRLF : EOL_LF;
}
warning(_("illegal crlf_action %d"), (int)crlf_action);
- return core_eol;
+ return repo_core_eol(repo);
}
static void check_global_conv_flags_eol(const char *path,
diff --git a/convert.h b/convert.h
index dae11d372d..3c51130177 100644
--- a/convert.h
+++ b/convert.h
@@ -19,17 +19,6 @@ struct strbuf;
extern int global_conv_flags_eol;
-enum eol {
- EOL_UNSET,
- EOL_CRLF,
- EOL_LF,
-#ifdef NATIVE_CRLF
- EOL_NATIVE = EOL_CRLF
-#else
- EOL_NATIVE = EOL_LF
-#endif
-};
-
enum ce_delay_state {
CE_NO_DELAY = 0,
CE_CAN_DELAY = 1,
@@ -84,7 +73,6 @@ struct conv_attrs {
void convert_attrs(struct index_state *istate,
struct conv_attrs *ca, const char *path);
-extern enum eol core_eol;
extern char *check_roundtrip_encoding;
const char *get_cached_convert_stats_ascii(struct index_state *istate,
const char *path);
diff --git a/environment.c b/environment.c
index bbac8ed8c9..6445994986 100644
--- a/environment.c
+++ b/environment.c
@@ -49,7 +49,6 @@ int fsync_object_files = -1;
int use_fsync = -1;
enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;
enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;
-enum eol core_eol = EOL_UNSET;
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
char *check_roundtrip_encoding;
#ifndef OBJECT_CREATION_MODE
@@ -158,6 +157,13 @@ enum auto_crlf repo_auto_crlf(struct repository *repo)
: AUTO_CRLF_FALSE;
}
+enum eol repo_core_eol(struct repository *repo)
+{
+ return repo->initialized
+ ? repo_config_values(repo)->core_eol
+ : EOL_UNSET;
+}
+
const char *repo_excludes_file(struct repository *repo)
{
struct repo_config_values *cfg = repo_config_values(repo);
@@ -447,13 +453,13 @@ int git_default_core_config(const char *var, const char *value,
if (!strcmp(var, "core.eol")) {
if (value && !strcasecmp(value, "lf"))
- core_eol = EOL_LF;
+ cfg->core_eol = EOL_LF;
else if (value && !strcasecmp(value, "crlf"))
- core_eol = EOL_CRLF;
+ cfg->core_eol = EOL_CRLF;
else if (value && !strcasecmp(value, "native"))
- core_eol = EOL_NATIVE;
+ cfg->core_eol = EOL_NATIVE;
else
- core_eol = EOL_UNSET;
+ cfg->core_eol = EOL_UNSET;
return 0;
}
@@ -784,6 +790,7 @@ void repo_config_values_init(struct repo_config_values *cfg)
cfg->has_symlinks = platform_has_symlinks();
cfg->use_nanosec = 0;
cfg->auto_crlf = AUTO_CRLF_FALSE;
+ cfg->core_eol = EOL_UNSET;
/* section "sparse" config values */
cfg->sparse_expect_files_outside_of_patterns = 0;
diff --git a/environment.h b/environment.h
index 872da3576b..bf6701560d 100644
--- a/environment.h
+++ b/environment.h
@@ -129,6 +129,17 @@ enum auto_crlf {
AUTO_CRLF_INPUT = -1
};
+enum eol {
+ EOL_UNSET,
+ EOL_CRLF,
+ EOL_LF,
+#ifdef NATIVE_CRLF
+ EOL_NATIVE = EOL_CRLF
+#else
+ EOL_NATIVE = EOL_LF
+#endif
+};
+
struct repo_config_values {
/* section "core" config values */
char *attributes_file;
@@ -156,6 +167,7 @@ struct repo_config_values {
int has_symlinks;
int use_nanosec;
enum auto_crlf auto_crlf;
+ enum eol core_eol;
/* section "sparse" config values */
int sparse_expect_files_outside_of_patterns;
@@ -212,6 +224,8 @@ int repo_has_symlinks(struct repository *repo);
enum auto_crlf repo_auto_crlf(struct repository *repo);
+enum eol repo_core_eol(struct repository *repo);
+
const char *repo_excludes_file(struct repository *repo);
void repo_config_values_init(struct repo_config_values *cfg);
--
2.43.0
Technical Details
Message-ID:
<20261024220012.486-4-aniketgupta3001@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73181-linux-kernel-git=dewy.ruReferences:
<20261024220012.486-1-aniketgupta3001@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73181-linux-kernel-git=dewy.ru
From: aniketgupta3001@gmail.com (Aniket Gupta)
Newsgroups: linux.kernel.git
Subject: [PATCH 3/4] environment: move core_eol into repo_config_values
Date: Sat, 24 Oct 2026 22:00:11 +0000
Organization: Usenet Network
Message-ID: <20261024220012.486-4-aniketgupta3001@gmail.com>
References: <20261024220012.486-1-aniketgupta3001@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="872530"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NgCLL9tMhdlK91A6psjju+p6r2o= sha256:6RtPFP4LsN8u9mqyi8b2fXt+gv94vHmtS4dVFwFeKMw=
sha1:8Usw2L3mw7GwYxT2gHPBGmRasxE= sha256:rN6Kr2KYsSj5t0HfIIuK3TwnWCNOa0yzC3VOVSIFwuo=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id AA71B1116AD; Sun, 25 Oct 2026 01:01:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id Nq8ZBz9jXLmT;
Sun, 25 Oct 2026 01:01:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73181-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 53D9C11003D; Sun, 25 Oct 2026 01:00:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 4309530D1F; Sat, 24 Oct 2026 22:00:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792879234;
b=XZaV+n1UinrSjC7Pl759xQKPOB7PQuzIzUbIePDA032ZjMlwNE5Z/D/3ibyLuL/R8WuP
WOL+BGcoYb9avNMfdutLClj1Uxl5zye2rCDpPHbR5AYmJTe8x21v2g/WmAVWVPI1XxHjQ
L6ynSGnMHeJD/e9C6gys1+wANL6Zmr+IdbJcuCOhSkAXads+TGTST7aqxlo/MAaQ7KXA6
SgCRz+DoJ7Fo2cULvLO8IktV9J58vaD24A9TNLhJyHoqSnvGjiZYWFdIHpt2mkg4Pt6Fq
q52pe+O/pD1QQGJp4ghTqnaJ4LOZIwAT1Sf5Yg482St77e/jfEv2jHhtmQ9tRXzxwnw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792879234;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=F2WpylZO8DZ4AjkEeHI08TI3uQLXPEUr6DCTZqm7O6s=;
b=se0u/sLvwqmUlcpeIu8d8jxfqp6QrNNZzVdjtdPNz6ave+qCOf3Hf4zLr78EDhWWD5BA
/CF1hCBCz0NocnyQE5Qgw21zWpkG1aVQCfFq/hcWb6Ur9keKzazTeBruB7r4m4UzvvjDf
yaAyZ3nO4rd56tpNpNXkaZbUaSECcsQkerXB1s4FLNaV5ATl49NmynxmYfPjE8bBcnEvo
AKmHuuRCZaOwsz2PdA6rRPRoCANUu57zAmlMZ2Q+3Pgaz+Pfq+v3NBNsPrQrdPvomp+Zg
N0EhxQziczukv83Xd41Bbvft2WD7RDOir1Ufv0+PcB13SsjLOds6M1PkBtP9dMeaW5g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b="rwg4ZEE/";
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B169606A322;
Sat, 24 Oct 2026 22:00:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=rwg4ZEE/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792879233;
b=ZQX96aBw5lojt78N+NKELt38kOcrMM5KWg9+7jqC1nlY6HZx6GlIyxaN5/42ioHZDuT9
gnYzEwcfeDS7OjOFZmntzSgE45CuM78gB8qtFXm3e7l4KlivBzAAoq99AflqbSbYTGgTO
sb//VOB9U8hP78dtqSCw0n050d7S2vDuDP/Y21veAp1uAbBG41L91Lp8R7Tm2Npy5H5RB
a6SS7/7YLiOEyOJ1aR5LkBkJmYnOtEyPMIgsTWYV/Qpn3ogAJdtWmeV77cogOe5aYkkPw
a6f9Q2ZjmznKv39Lo1qkxjabYnrcx8Dc0+d11WR99K3zu6ZNME+qOtTXTmfmD+OuWrg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792879233;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=F2WpylZO8DZ4AjkEeHI08TI3uQLXPEUr6DCTZqm7O6s=;
b=DlVpgSrsSfqzv4HTL94UxKEyiu9r8Ve9QruH+xObEk6MnDn3R5GG8zxCH6r3/bHyzJ+s
5t+quNNzL6M+jx+5qBkTl5S0xMYH/xnefhXUew1K/O/hFSFeNFiav/dbQkvd9aDczlBp0
mW+SJ2siV7nIOGbnIQCDJqmToFNutMG1qzsXdexOCKeFVBnBSpKet9gzMvDopjR3YtRtQ
7UG3uZwjOlWJ2+8cnw2gORBSOIYl1kL1xsyPRwqk/HaUkbjdpkfqQllYd12kqNwfTffQe
KbeiyJb099jS42xP7QEJqMRczIqtBed4oWxPcc/PhuJCetEMBGAIDDO0AJoUX6nvCOQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b="rwg4ZEE/";
arc=none smtp.remote-ip=74.125.82.47
X-Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D122E606A31B
for <git@vger.kernel.org>; Sat, 24 Oct 2026 22:00:32 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D122E606A31B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-15ea896ddc8so3224152c88.0
for <git@vger.kernel.org>; Sat, 24 Oct 2026 15:00:32 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792879232; x=1793484032; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=F2WpylZO8DZ4AjkEeHI08TI3uQLXPEUr6DCTZqm7O6s=;
b=rwg4ZEE/PaGTc0rRisA9FGqxNrptapTvboxNosv9BXzd2UGHCtRUAssjdlapb2Qmj5
VizbnSnLBV0hdO1a6PGQboqU55ii90SZ9U3fKc8yY79q4IwyMEa0kTNrBYROZlG6QEG1
ozIz5FwNeKCFUDalkQn5vc6sDiAUs7csu3ZqQkDGNeLLaMYF4pjgoJF76dyKDLUwicp3
F6Or0E2HCVyG35uYCR6vLlfHoxf7FLUbA9FqHaGtNBWsaq/2HgakAKtM6oeISLY9erXC
+ar3xA3KkXlyBIm70PRatBCiDBwaVH5iaFIVhIyE+umB9AU6jCIy0C3LPjbvyA8vA1T9
ZioA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792879232; x=1793484032;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=F2WpylZO8DZ4AjkEeHI08TI3uQLXPEUr6DCTZqm7O6s=;
b=U/1jKD+Qlo65uT2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aYc
2FvZnNGzsC2MGlBG/QPnNuSAA1t4B9EKCRDpig3NwA==
X-Received: by 2002:a05:7022:5f09:b0:15e:6541:3099 with SMTP id a92af1059eb24-19933e10e21mr4470804c88.7.1792879231761;
Sat, 24 Oct 2026 15:00:31 -0700 (PDT)
X-Received: from LAPTOP-PVRSMPQK.iiitd.edu.in ([103.25.231.125])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-198a0f81ea9sm11578875c88.11.2026.10.24.15.00.27
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 24 Oct 2026 15:00:30 -0700 (PDT)
X-Cc: gitster@pobox.com,
christian.couder@gmail.com,
cat@malon.dev,
belkid98@gmail.com,
ps@pks.im,
phillip.wood123@gmail.com
X-Mailer: git-send-email 2.56.0.240.gf97865f162
X-In-Reply-To: <20261024220012.486-1-aniketgupta3001@gmail.com>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list