public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>, git@vger.kernel.org
Cc: phillip.wood@dunelm.org.uk, ps@pks.im
Subject: Re: [PATCH v2 1/3] worktree: remove "the_repository" from is_current_worktree()
Date: Mon, 23 Mar 2026 14:37:51 +0000	[thread overview]
Message-ID: <532616a4-d410-4a38-8038-1fd22e39217f@gmail.com> (raw)
In-Reply-To: <20260323094341.880375-1-shreyanshpaliwalcmsmn@gmail.com>

On 23/03/2026 09:41, Shreyansh Paliwal wrote:
> 
> This may be slightly out of scope for this series. My understanding so far
> has been that originally wt == NULL is used to represent the 'current worktree',
> which eventually meant following the process-wide state (the_repository).
> With the ongoing multi-repository work, the meaning is being changed to be
> interpreted as 'the worktree associated with the repository that we are working in'.
> However, in path.c there are some callers of repo_git_pathv() passing wt as 'NULL',
> I know that there is not involvement of the_repository state but it would be create
> less confusion if the semantics of worktrees are same everywhere. So if we replace
> those NULL callers with the current worktree and update the checks of (!wt) to
> (is_current_worktree(wt)), some tests are failing mostly related to refs of linked
> worktrees, and I think the error is originating from this,
> 
>          if (!wt)
>                  adjust_git_path(repo, buf, gitdir_len);
> 
> So I am a bit confused to whether wt being NULL here could mean something else
> behaviour wise ?

That line comes from 543107333b3 (path: worktree_git_path() should not 
use file relocation, 2017-06-22) which explains why we don't adjust the 
patch when wt is non-NULL. worktree_git_path() is called from 
builtin/fsck.c in a loop over all worktrees so changing 'if (!wt)' 'if 
(!wt->is_current)' will change the behavior for the current worktree. 
While it might be nice to clean this up in the future, it is an internal 
helper function so I'm less worried it than if it were a public function.

Thanks

Phillip

  reply	other threads:[~2026-03-23 14:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 14:19 [PATCH 0/3] worktree: stop using "the_repository" in is_current_worktree() Phillip Wood
2026-03-13 14:19 ` [PATCH 1/3] worktree: remove "the_repository" from is_current_worktree() Phillip Wood
2026-03-13 14:19 ` [PATCH 2/3] worktree add: stop reading ".git/HEAD" Phillip Wood
2026-03-13 21:41   ` Junio C Hamano
2026-03-13 14:19 ` [PATCH 3/3] worktree: reject NULL worktree in get_worktree_git_dir() Phillip Wood
2026-03-13 21:42   ` Junio C Hamano
2026-03-14 20:09     ` Phillip Wood
2026-03-15 16:18 ` [PATCH v2 0/3] worktree: stop using "the_repository" in is_current_worktree() Phillip Wood
2026-03-15 16:18   ` [PATCH v2 1/3] worktree: remove "the_repository" from is_current_worktree() Phillip Wood
2026-03-16  7:38     ` Patrick Steinhardt
2026-03-16 16:22       ` Phillip Wood
2026-03-17 10:24         ` Phillip Wood
2026-03-23  9:41           ` Shreyansh Paliwal
2026-03-23 14:37             ` Phillip Wood [this message]
2026-03-23 17:05               ` Shreyansh Paliwal
2026-03-15 16:18   ` [PATCH v2 2/3] worktree add: stop reading ".git/HEAD" Phillip Wood
2026-03-16  7:39     ` Patrick Steinhardt
2026-03-15 16:18   ` [PATCH v2 3/3] worktree: reject NULL worktree in get_worktree_git_dir() Phillip Wood
2026-03-15 21:17   ` [PATCH v2 0/3] worktree: stop using "the_repository" in is_current_worktree() Junio C Hamano
2026-03-26 14:16 ` [PATCH v3 " Phillip Wood
2026-03-26 14:16   ` [PATCH v3 1/3] worktree: remove "the_repository" from is_current_worktree() Phillip Wood
2026-03-26 15:48     ` Junio C Hamano
2026-03-27 16:40       ` Phillip Wood
2026-03-27 17:07         ` Junio C Hamano
2026-03-26 14:16   ` [PATCH v3 2/3] worktree add: stop reading ".git/HEAD" Phillip Wood
2026-03-26 14:16   ` [PATCH v3 3/3] worktree: reject NULL worktree in get_worktree_git_dir() Phillip Wood

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=532616a4-d410-4a38-8038-1fd22e39217f@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=ps@pks.im \
    --cc=shreyanshpaliwalcmsmn@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