All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Tobler <jltobler@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 03/13] setup: unify setup of shallow file
Date: Mon, 6 Jul 2026 17:02:08 -0500	[thread overview]
Message-ID: <akwkS45ZknejwhuO@denethor> (raw)
In-Reply-To: <20260630-pks-setup-split-discovery-and-setup-v1-3-13864eb5a032@pks.im>

On 26/06/30 01:47PM, Patrick Steinhardt wrote:
> It is possible to configure an arbitrary "shallow" file via two
> mechanisms, and the respective logic to handle these is split across two
> locations:
> 
>   - Via the "GIT_SHALLOW_FILE" environment variable, which is handled in
>     `setup_git_env_internal()`.
> 
>   - Via the global "--shallow-file=" command line option, which is
>     handled in `handle_options()`.

Ok.

> We can rather easily unify this logic by not configuring the shallow
> file in `handle_options()`, but instead overwriting the environment
> variable. The environment variable itself is then handled inside of
> `apply_repository_format()`, which is responsible for configuring a
> discovered Git directory.

What is supposed to be the correct order for processing shallow file
configuration here? Does this mean that the `--shallow-file` option now
overwrites the environment variable? Was this how it already was?

> This new logic is similar in nature to how we handle the other global
> options already, all of which end up setting an environment variable.
> So for one this gives us more consistency. But more importantly, this
> change means that `the_repository` will not contain any relevant state
> anymore before we hit `apply_repository_format()` once we're at the end
> of this patch series. Consequently, it will become possible for us to
> completely discard `the_repository` and populate it anew.

I can't say that I'm a fan of using environment variables to store
global state in this manner, but I guess if there is precdent and this
is making us more consistent, it is probably fine. I guess the other
option would be to store the read configuration is some intermediate
structure to be applied later, but that may not be worth it here.

-Justin

  reply	other threads:[~2026-07-06 22:02 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 11:47 [PATCH 00/13] setup: split up repository discovery and setup Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 01/13] setup: rename `check_repository_format_gently()` Patrick Steinhardt
2026-07-06 21:27   ` Justin Tobler
2026-06-30 11:47 ` [PATCH 02/13] setup: mark bogus worktree in `apply_repository_format()` Patrick Steinhardt
2026-06-30 18:26   ` Junio C Hamano
2026-07-01  6:23     ` Patrick Steinhardt
2026-07-06 21:49   ` Justin Tobler
2026-07-07  6:25     ` Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 03/13] setup: unify setup of shallow file Patrick Steinhardt
2026-07-06 22:02   ` Justin Tobler [this message]
2026-07-07  6:25     ` Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 04/13] setup: split up concerns of `setup_git_env_internal()` Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 05/13] setup: introduce explicit repository discovery Patrick Steinhardt
2026-07-06 22:19   ` Justin Tobler
2026-07-07  6:25     ` Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 06/13] setup: embed repository format in discovery Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 07/13] setup: move prefix into repository Patrick Steinhardt
2026-07-06 22:33   ` Justin Tobler
2026-06-30 11:47 ` [PATCH 08/13] setup: drop static `cwd` variable Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 09/13] setup: propagate prefix via repository discovery Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 10/13] setup: make repository discovery self-contained Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 11/13] setup: drop redundant configuration of `startup_info->have_repository` Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 12/13] setup: pass worktree to `init_db()` Patrick Steinhardt
2026-06-30 11:47 ` [PATCH 13/13] setup: mark `set_git_work_tree()` as file-local Patrick Steinhardt
2026-07-07  7:21 ` [PATCH v2 00/13] setup: split up repository discovery and setup Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 01/13] setup: rename `check_repository_format_gently()` Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 02/13] setup: mark bogus worktree in `apply_repository_format()` Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 03/13] setup: unify setup of shallow file Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 04/13] setup: split up concerns of `setup_git_env_internal()` Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 05/13] setup: introduce explicit repository discovery Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 06/13] setup: embed repository format in discovery Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 07/13] setup: move prefix into repository Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 08/13] setup: drop static `cwd` variable Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 09/13] setup: propagate prefix via repository discovery Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 10/13] setup: make repository discovery self-contained Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 11/13] setup: drop redundant configuration of `startup_info->have_repository` Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 12/13] setup: pass worktree to `init_db()` Patrick Steinhardt
2026-07-07  7:21   ` [PATCH v2 13/13] setup: mark `set_git_work_tree()` as file-local Patrick Steinhardt

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=akwkS45ZknejwhuO@denethor \
    --to=jltobler@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.