Re: git rebase exec make -C in worktree confuses repo root dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 15, 2024 at 2:55 PM David Moberg <kaddkaka@xxxxxxxxx> wrote:
> Den tis 15 okt. 2024 kl 09:11 skrev Eric Sunshine <sunshine@xxxxxxxxxxxxxx>:
> > This looks like unintentional behavior; probably a bug. It seems to be
> > triggered by `git rebase -i` setting GIT_DIR. Here's an even simpler
> > reproduction recipe:
> >
> >     % git init foo
> >     % cd foo
> >     % mkdir dir
> >     % echo foo >dir/file
> >     % git add dir/file
> >     % git commit -m foo
> >     % git worktree add ../bar
> >     % cd ../bar
> >     % git -C dir rev-parse --show-toplevel
> >     /.../bar
> >     % GIT_DIR=../../foo/.git/worktrees/bar \
> >         git -C dir rev-parse --show-toplevel
> >     /.../bar/dir
> >
> > The `git rev-parse --show-toplevel` invocation with GIT_DIR set is
> > incorrectly returning `/.../bar/dir` rather than `/.../bar`.
>
> Thanks, that is indeed a much smaller example and it seems to exhibit
> the same issue. Can we figure out how to fix it?

Someone is going to have to dig into the code, but my Git time is very
limited right now, so perhaps someone else can do the digging.

If you want an immediate workaround for the problem for your specific
use-case, you can probably unset GIT_DIR in your `exec` instruction.

(By the way, please avoid top-posting when you reply on this list;
instead, post inline as I did here.)





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux