git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Ayush Chandekar <ayu.chandekar@gmail.com>, phillip.wood@dunelm.org.uk
Cc: christian.couder@gmail.com, git@vger.kernel.org,
	shyamthakkar001@gmail.com, gitster@pobox.com, ps@pks.im,
	ben.knoble@gmail.com
Subject: Re: [GSOC PATCH v5 3/3] environment: remove the global variable 'sparse_expect_files_outside_of_patterns'
Date: Wed, 2 Jul 2025 10:01:31 +0100	[thread overview]
Message-ID: <70a10ec5-9fb7-4b7e-b4e3-3d04fb44c23e@gmail.com> (raw)
In-Reply-To: <CAE7as+YeTuQh_BzZSLuVTimrddp5-OBtpMa81KFhd+3zDqDiMg@mail.gmail.com>

Hi Ayush

On 02/07/2025 00:53, Ayush Chandekar wrote:
> On Tue, Jul 1, 2025 at 6:48 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
>> On 30/06/2025 20:27, Ayush Chandekar wrote:
>>>
>>>    void clear_skip_worktree_from_present_files(struct index_state *istate)
>>>    {
>>> +     int sparse_expect_files_outside_of_patterns = 0;
>>> +     repo_config_get_bool(istate->repo, "sparse.expectfilesoutsideofpatterns",
>>> +             &sparse_expect_files_outside_of_patterns);
>>
>> This changes the user facing behavior if
>> sparse.expectfilesoutsideofpatterns is not a valid boolean value.
>> Currently git will error out when it first starts because that config
>> value is parsed by git_default_config() which is called by almost all
>> git commands. This means that if someone sets an invalid value they get
>> timely feedback that the value is invalid and git dies before doing
>> anything. Now, if the value is invalid, git will only die if this
>> function is called and it is likely to die in the middle of a command.
> 
> Yes, I get your point. However, if we look at settings which are
> shifted to `struct repo_settings`, the behaviour is to set a
> fallback/default value in case of an invalid input, instead of
> throwing an error. This is done inside the `prepare_repo_settings()`
> function, which is often called in the middle of a process.

I'm a bit confused by this and I'm not quite sure what you're saying for 
a couple of reasons. Firstly this patch is not adding a new member to 
struct repo_settings, it is parsing the config directly and will die() 
in git_config_bool() if the config value is invalid. Secondly 
prepare_repo_settings() ends up calling git_config_bool() and so will 
also die if the config value is invalid rather than setting a default 
value. In the case of prepare_repo_settings() commands that do not want 
to die in the middle of an operation can call that function early on 
before they start doing any real work. Looking at the output of "git 
grep prepare_repo_settings()" many do exactly that. Here there is no 
option for a command to die() early on invalid config values if it wants to.

Thanks

Phillip


  reply	other threads:[~2025-07-02  9:01 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03 13:18 [GSOC PATCH] environment: move access to "core.sparsecheckout" into repo_settings Ayush Chandekar
2025-06-03 13:41 ` Patrick Steinhardt
2025-06-03 16:20   ` Ayush Chandekar
2025-06-04  2:20     ` Ben Knoble
2025-06-04  7:28       ` Patrick Steinhardt
2025-06-04 23:48       ` Ayush Chandekar
2025-06-08  0:31 ` [GSOC PATCH v2] " Ayush Chandekar
2025-06-08  6:39   ` Christian Couder
2025-06-11 17:34 ` [PATCH v3] " Ayush Chandekar
2025-06-11 21:06   ` Junio C Hamano
2025-06-11 21:33     ` Junio C Hamano
2025-06-13  6:57       ` Ayush Chandekar
2025-06-17 12:06 ` [GSOC PATCH v4 0/3] environment: remove sparse-checkout related global variables Ayush Chandekar
2025-06-17 12:06   ` [GSOC PATCH v4 1/3] environment: move access to "core.sparsecheckout" into repo_settings Ayush Chandekar
2025-06-17 16:15     ` Junio C Hamano
2025-06-17 12:06   ` [GSOC PATCH v4 2/3] environment: move access to "core.sparsecheckoutcone" " Ayush Chandekar
2025-06-17 16:29     ` Junio C Hamano
2025-06-17 12:06   ` [GSOC PATCH v4 3/3] environment: remove the global variable 'sparse_expect_files_outside_of_patterns' Ayush Chandekar
2025-06-17 16:30     ` Junio C Hamano
2025-06-30 19:27 ` [GSOC PATCH v5 0/3] environment: remove sparse-checkout related global variables Ayush Chandekar
2025-06-30 19:27   ` [GSOC PATCH v5 1/3] environment: move access to "core.sparsecheckout" into repo_settings Ayush Chandekar
2025-06-30 19:27   ` [GSOC PATCH v5 2/3] environment: move access to "core.sparsecheckoutcone" " Ayush Chandekar
2025-06-30 19:27   ` [GSOC PATCH v5 3/3] environment: remove the global variable 'sparse_expect_files_outside_of_patterns' Ayush Chandekar
2025-07-01 13:18     ` Phillip Wood
2025-07-01 23:53       ` Ayush Chandekar
2025-07-02  9:01         ` Phillip Wood [this message]
2025-07-11 19:24           ` Ayush Chandekar
2025-07-02  9:21         ` Junio C Hamano
2025-07-11 19:35           ` Ayush Chandekar
2025-06-30 21:08   ` [GSOC PATCH v5 0/3] environment: remove sparse-checkout related global variables Junio C Hamano
2025-07-09  0:18   ` Junio C Hamano
2025-07-09  1:39     ` Ayush Chandekar
2025-07-19  0:11 ` [GSOC PATCH v6 " Ayush Chandekar
2025-07-19  0:11   ` [GSOC PATCH v6 1/3] environment: move access to "core.sparsecheckout" into repo_settings Ayush Chandekar
2025-07-19  0:11   ` [GSOC PATCH v6 2/3] environment: move access to "core.sparsecheckoutcone" " Ayush Chandekar
2025-07-19  0:11   ` [GSOC PATCH v6 3/3] environment: remove the global variable 'sparse_expect_files_outside_of_patterns' Ayush Chandekar
2025-07-23 22:14   ` [GSOC PATCH v6 0/3] environment: remove sparse-checkout related global variables Junio C Hamano
2025-07-24 13:25     ` Derrick Stolee
2025-07-24 18:44       ` Junio C Hamano
2025-07-29 11:36       ` Ayush Chandekar
2025-07-29 12:19         ` Derrick Stolee
2025-07-29 12:53         ` Ayush Chandekar
2025-07-30  8:53       ` Phillip Wood
2025-07-30 15:52         ` Junio C Hamano
2025-07-26 23:55     ` Ayush Chandekar
2025-08-10 15:36   ` Ayush Chandekar
2025-08-26 12:20     ` Derrick Stolee
2025-08-27 21:31       ` Ayush Chandekar
2025-09-05 14:15         ` Junio C Hamano
2025-09-05 17:10           ` Junio C Hamano

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=70a10ec5-9fb7-4b7e-b4e3-3d04fb44c23e@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=ayu.chandekar@gmail.com \
    --cc=ben.knoble@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=ps@pks.im \
    --cc=shyamthakkar001@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;
as well as URLs for NNTP newsgroup(s).