public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail•com>
To: 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,
	bkkaracay@gmail•com, lucasseikioshiro@gmail•com
Subject: Re: [GSOC][PATCH 1/2] editor: make editor_program local to editor.c
Date: Sun,  1 Mar 2026 21:12:30 +0530	[thread overview]
Message-ID: <20260301154905.13993-1-shreyanshpaliwalcmsmn@gmail.com> (raw)
In-Reply-To: <aaQzlE2lsq4WfFxt@fedora>

> Hi Shreyansh,
>
> I am a GSoC applicant like you. I just wanted to leave my two cents
> here.
>
> On Sun, Mar 01, 2026 at 04:12:58PM +0530, Shreyansh Paliwal wrote:
> >+static char *editor_program;
> >+
> >+int set_editor_program(const char *var, const char *value)
> >+{
> >+	FREE_AND_NULL(editor_program);
> >+	return git_config_string(&editor_program, var, value);
> >+}
> >+
>
> While moving the global variable from 'environment.c' to 'editor.c'
> doesn't cause any behavior change, it still relies on global state.
>
> I think passing a 'struct repository' and using the 'repo_config_get*'
> helpers here might be a more robust approach. I know this means we would
> catch config errors later (right before the editor start up). However,
> since it doesn't seem like it would cause a data loss or serious issues,
> this behavioral change feels like a reasonable trade-off.
>
> Thanks again for the patches!

Hi Burak,

Thanks for the feedback on this, I appreciate you taking the time to look.

I did consider the approach you suggested. Currently, editor_program is
only used within editor.c, and it is I believe a process-wide setting rather
than something tied to a specific repository. Because of that, it did not
seem necessary to add it to struct repository or repo_settings at this stage.

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.

That said, I agree that there may be a better way to do this refactor,
so I'd be glad to hear more thoughts on this :)

Best,
Shreyansh

[1]- https://lore.kernel.org/git/1d43d1d0-bf6b-4806-834e-89f545fab766@gmail.com/
[2]- https://lore.kernel.org/git/xmqqpl63b2tm.fsf@gitster.g/

  reply	other threads:[~2026-03-01 15:49 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 [this message]
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 ` [GSOC][PATCH 0/2] Remove global state from editor.c Tian Yuchen
2026-03-10 17:40 ` [GSOC][PATCH v2 " 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=20260301154905.13993-1-shreyanshpaliwalcmsmn@gmail.com \
    --to=shreyanshpaliwalcmsmn@gmail$(echo .)com \
    --cc=ayu.chandekar@gmail$(echo .)com \
    --cc=bkkaracay@gmail$(echo .)com \
    --cc=christian.couder@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jltobler@gmail$(echo .)com \
    --cc=karthik.188@gmail$(echo .)com \
    --cc=lucasseikioshiro@gmail$(echo .)com \
    --cc=siddharthasthana31@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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