From: Eric Sunshine <sunshine@sunshineco.com>
To: "Gabriel Nützi" <gnuetzi@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: GIT_DIR output from git worktree list
Date: Wed, 30 Sep 2020 01:33:11 -0400 [thread overview]
Message-ID: <CAPig+cTwNwt+_f4FYDqy5xVsDVU3pqfKXtK6GKtWLLqbU6Y8Vg@mail.gmail.com> (raw)
In-Reply-To: <CAA9rTudStQOK7kRa6jYJHE3D3grnFF3idQe65h9t6oJB30xa1A@mail.gmail.com>
On Tue, Sep 29, 2020 at 1:31 PM Gabriel Nützi <gnuetzi@gmail.com> wrote:
> When you do move the .git folder somewhere else:
>
> git init Test && cd Test && mv .git .git-b
> git --git-dir=.git-b --work-tree . worktree list
>
> the output is :
> ..../Test/.git-b 0000000 [master]
>
> Why is the output a .git Dir and not a worktree. I expected `.../Test`.
Because the implementation doesn't really look for or know where the
main worktree is. Instead, it's taking the path of the repository and
stripping off "/.git" if present, and reporting that as the main
worktree. Under normal circumstances this works just fine because
either (a) the repository _is_ the .git directory within the main
worktree, or (b) it's a bare repository and there is no main worktree,
thus it reports the repository path instead of the non-existent main
worktree.
I suppose one way to fix this would be to specially check if
--work-tree or GIT_WORK_TREE is specified and use that value as the
path of the main worktree. (This special case would only be used when
computing the main worktree path; it would not be used when computing
linked worktree paths.)
next prev parent reply other threads:[~2020-09-30 5:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 17:30 GIT_DIR output from git worktree list Gabriel Nützi
2020-09-30 5:33 ` Eric Sunshine [this message]
2020-09-30 7:34 ` Gabriel Nützi
2020-09-30 20:35 ` Eric Sunshine
2020-12-07 4:34 ` Eric Sunshine
2020-12-07 7:28 ` Ganriel Nützi
2020-12-08 19:27 ` Eric Sunshine
2020-12-09 9:30 ` Duy Nguyen
2020-12-13 6:07 ` Eric Sunshine
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPig+cTwNwt+_f4FYDqy5xVsDVU3pqfKXtK6GKtWLLqbU6Y8Vg@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gnuetzi@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).