From: Tian Yuchen <a3205153416@gmail.com>
To: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>, git@vger.kernel.org
Cc: gitster@pobox.com, christian.couder@gmail.com,
karthik.188@gmail.com, jltobler@gmail.com,
ayu.chandekar@gmail.com, siddharthasthana31@gmail.com,
lucasseikioshiro@gmail.com
Subject: Re: [GSOC][PATCH 0/2] Remove global state from editor.c
Date: Mon, 2 Mar 2026 00:39:33 +0800 [thread overview]
Message-ID: <feafa9bf-b1a3-4067-8b2f-5dbad1940578@gmail.com> (raw)
In-Reply-To: <20260301105228.1738388-1-shreyanshpaliwalcmsmn@gmail.com>
Hi Shreyansh and Burak,
Thanks for the patch.
Reading through discussion, I think both of you highlighted very valid
constraints:
> While moving the global variable from 'environment.c' to 'editor.c'
> doesn't cause any behavior change, it still relies on global state.
Yes, changing an extern to a static variable doesn't truly remove the
global state, right?
> More importantly, my intention for this was to keep original behavior as-is.
> As noted in earlier discussions [1][2], maintaining early config validation
> is important so that invalid core.editor values are caught early. Moving to
> a repo-based lazy lookup would change that.
This one also makes sense to me.
However,
> I believe a process-wide setting rather
> than something tied to a specific repository.
I have reservations about this, and I believe this is the most critical
issue. For instance, we can run:
git config --local core.editor "nvim"
where the configuration is written in the .git/config of the current
repository. If core.editor is process-wide, git should not permit the
existence of a "local" core.editor at all. Since it can be set for
individual repositories, it should be tied to the specific struct
repository, right?
A more intuitive case is:
Repo A: core.editor = vim
Repo B: core.editor = nvim
For users managing multiple repositories (submodules), it's perfectly
reasonable to use different editors in different contexts. At least for
me, I use different configurations for Vim and NVim, and I switch
between different editors when writing with different languages. (like
set textwidth=72 for Git? _(:3 ⌒゙)_)
I recently faced the same dilemma migrating git_commit_encoding and
git_log_output_encoding. I personally believe that adding editor_program
to repo-settings.c is the best approach.
By doing this:
- We truly eliminate the global state. Each struct repository gets its
own editor setting.
- We maintain early validation. The config can still be parsed early
(e.g., during prepare_repo_settings()?)
Thanks again for the patch.
Regards,
Yuchen
next prev parent reply other threads:[~2026-03-01 16:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 10:42 [GSOC][PATCH 0/2] Remove global state from editor.c Shreyansh Paliwal
2026-03-01 10:42 ` [GSOC][PATCH 1/2] editor: make editor_program local to editor.c Shreyansh Paliwal
2026-03-01 13:19 ` Burak Kaan Karaçay
2026-03-01 15:42 ` Shreyansh Paliwal
2026-03-01 16:22 ` Phillip Wood
2026-03-01 18:30 ` Burak Kaan Karaçay
2026-03-09 10:36 ` Karthik Nayak
2026-03-01 10:42 ` [GSOC][PATCH 2/2] editor: remove the_repository usage Shreyansh Paliwal
2026-03-09 10:37 ` Karthik Nayak
2026-03-01 16:39 ` Tian Yuchen [this message]
2026-03-10 17:40 ` [GSOC][PATCH v2 0/2] Remove global state from editor.c Shreyansh Paliwal
2026-03-10 17:40 ` [GSOC][PATCH v2 1/2] editor: make editor_program local to editor.c Shreyansh Paliwal
2026-03-10 17:40 ` [GSOC][PATCH v2 2/2] editor: remove the_repository usage Shreyansh Paliwal
2026-03-17 16:03 ` [GSOC][PATCH v2 0/2] Remove global state from editor.c Shreyansh Paliwal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=feafa9bf-b1a3-4067-8b2f-5dbad1940578@gmail.com \
--to=a3205153416@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=karthik.188@gmail.com \
--cc=lucasseikioshiro@gmail.com \
--cc=shreyanshpaliwalcmsmn@gmail.com \
--cc=siddharthasthana31@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox