git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Sivanandan Srilakshmanan <ssrilaks@gmail.com>,
	Pratyush Yadav <me@yadavpratyush.com>,
	git@vger.kernel.org
Subject: Re: working directory status
Date: Mon, 18 Nov 2019 16:12:02 +0900	[thread overview]
Message-ID: <xmqqk17x1wvx.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <6bb36048-6649-ebe3-062f-c5564f7d4ec4@kdbg.org> (Johannes Sixt's message of "Sun, 17 Nov 2019 23:26:14 +0100")

Johannes Sixt <j6t@kdbg.org> writes:

> ...
> Do not set GIT_DIR if you do not understand the consequences.

I think the explanation in your earlier message was probably a bit
more helpful.  If they want to use GIT_DIR, they need to also set
and export GIT_WORK_TREE.

Of course, with both exported, asking "git branch" for which branch
is checked out would ask about the working tree that GIT_WORK_TREE
points at without consulting $(pwd), so it is rather pointless.
When the user switches to another worktree, both GIT_DIR and
GIT_WORK_TREE need to be updated to point at appropriate places, so
it sort of defeats the purpose.

>
>> C:\test\Local_Newfeature>git worktree list
>> C:\GitRepo                (bare)
>> C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]
>> C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]
>> C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]
>
> I do not know whether it is a sane use-case to have a bare repository
> and separate worktrees.
>
> Do not do that. Make a regular clone with a worktree and create
> secondary worktrees from there.

As long as GIT_DIR/GIT_WORK_TREE are both set and exported (or both
unset, a new worktree made out of a bare clone should work just
fine.  At least that is one of the use case I recall the feature was
designed to be used in.

Thanks.


  parent reply	other threads:[~2019-11-18  7:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-17  0:55 working directory status Sivanandan Srilakshmanan
2019-11-17  7:29 ` Pratyush Yadav
2019-11-17 11:07   ` Sivanandan Srilakshmanan
2019-11-17 12:30     ` Johannes Sixt
2019-11-17 20:33       ` Sivanandan Srilakshmanan
2019-11-17 22:26         ` Johannes Sixt
2019-11-18  4:32           ` Sivanandan Srilakshmanan
2019-11-18  6:51             ` Johannes Sixt
2019-11-18  7:01               ` Eric Sunshine
2019-11-18  7:12           ` Junio C Hamano [this message]
2019-11-18 10:40             ` Sivanandan Srilakshmanan

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=xmqqk17x1wvx.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=me@yadavpratyush.com \
    --cc=ssrilaks@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).