git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>,
	David Moberg <kaddkaka@gmail.com>
Cc: Elijah Newren <newren@gmail.com>, Taylor Blau <me@ttaylorr.com>,
	phillip.wood@dunelm.org.uk, david.moberg@mediatek.com,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git rebase exec make -C in worktree confuses repo root dir
Date: Thu, 28 Nov 2024 15:07:12 +0000	[thread overview]
Message-ID: <8a4ff61f-0545-4edf-9e90-1e16e4d55911@gmail.com> (raw)
In-Reply-To: <CAPig+cTVfNW4AFJKyGbRcy0_YJEJGcNYNx57USyp4zz1g9fSeQ@mail.gmail.com>

On 28/11/2024 07:36, Eric Sunshine wrote:
> On Wed, Nov 27, 2024 at 11:04 PM David Moberg <kaddkaka@gmail.com> wrote:
>>> To: Elijah Newren <newren@gmail.com>
>>>> My commit merely pointed out that long before that commit came along,
>>>> if GIT_DIR is set but GIT_WORK_TREE is not, then the working tree is
>>>> assumed to be ".".  As such, a command like the above where
>>>> `--show-toplevel` is run with just GIT_DIR set (to anything) will
>>>> merely expand "." and show you that path.
>>>>
>>>> If you are going to be having subprocesses that depend upon the git
>>>> directory and the git working tree, I think there are two options:
>>>>    * Set GIT_WORK_TREE in addition to GIT_DIR (as my patch does in certain cases)
>>>>    * Stop setting GIT_DIR if you're not going to set GIT_WORK_TREE
>>>>
>>>> The second point is a bit harder since setup.c automatically sets
>>>> GIT_DIR for you in various cases, so if you want to go that route it
>>>> really means you'd have to actively unset GIT_DIR in those cases.
>>>> But, you'd have to be careful since you only want to unset it when
>>>> setup_discovered_git_dir() sets it for you, not when the user who
>>>> invoked your command had manually set GIT_DIR.  So, there is a little
>>>> bit of a pickle here...
>>>
>>> So, what is the way forward? Is the option of setting GIT_WORK_TREE more robust?
>>
>> Hi, sorry for posting this on the side but I only have Gmail on android which doesn't allow text only emails (I think).
>>
>> Is there any work ongoing on this item? I think I lost the conversation and/or fell out of it.
> 
> The conversation ended at [1]. As far as I know, nobody is working on it.
> 
> I think Phillip did a good job in [1] of summarizing the two paths
> toward a possible fix. Unfortunately, both paths will probably require
> a good deal of spelunking through the code and the history to
> understand why the logic is the way it is, and (importantly) how to
> craft a solution which won't break existing legitimate use-cases.

I think the solution of always setting GIT_WORK_TREE and GIT_DIR is 
probably the most practical. Even if we find a way to not set GIT_DIR 
when git is run from a linked worktree I think we will still run into 
problems when core.worktree is set as that also appears to result in 
GIT_DIR being set without GIT_WORK_TREE.

> So, it's not necessarily a small task, and whoever digs into it (if
> anyone volunteers) will likely need to devote a good deal of time and
> effort to it. (My Git time is severely limited these days, so that
> person is unlikely to be me.)

In principle I'm interested in fixing this but in practice I'm unlikely 
to have time to work on it until the end of Outreachy in March. If 
someone else wants to take a look at it in the meantime I'll definitely 
try and make time to answer questions and review patches

Best Wishes

Phillip

> [1]: https://lore.kernel.org/git/743043bf-60b7-4ed7-8cf2-4f3f972968a6@gmail.com/


       reply	other threads:[~2024-11-28 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1730787532-3757-mlmmj-5e7be4fc@vger.kernel.org>
     [not found] ` <CAL2+Mivva3AFR4of0-2d48YDDMbHiNVsUmCzhezHfe+h9faEvQ@mail.gmail.com>
     [not found]   ` <CAPig+cTVfNW4AFJKyGbRcy0_YJEJGcNYNx57USyp4zz1g9fSeQ@mail.gmail.com>
2024-11-28 15:07     ` Phillip Wood [this message]
     [not found]     ` <f03edd8b-d863-4307-95d5-84f36b4e8349@gmail.com>
2024-11-28 18:02       ` HTML message rejected: Re: git rebase exec make -C in worktree confuses repo root dir Eric Sunshine
2024-10-14 20:46 David Moberg
2024-10-14 21:19 ` Taylor Blau
2024-10-14 21:34   ` David Moberg
2024-10-15  7:11   ` Eric Sunshine
2024-10-15 18:55     ` David Moberg
2024-10-15 20:01       ` Eric Sunshine
2024-10-16  9:15         ` Phillip Wood
2024-10-16 20:36           ` Taylor Blau
2024-10-17 21:16             ` Elijah Newren
2024-10-16 21:12           ` Eric Sunshine
2024-11-05 15:24             ` phillip.wood123

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=8a4ff61f-0545-4edf-9e90-1e16e4d55911@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=david.moberg@mediatek.com \
    --cc=git@vger.kernel.org \
    --cc=kaddkaka@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sunshine@sunshineco.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).