From: Junio C Hamano <gitster@pobox.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH v2 00/21] Support multiple worktrees
Date: Fri, 20 Dec 2013 12:32:43 -0800 [thread overview]
Message-ID: <xmqq7gaze00k.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CACsJy8BV6uerMyHNHviL0Jy8s+_jca8NM-hVfnM=u4cr-=JX1Q@mail.gmail.com> (Duy Nguyen's message of "Thu, 19 Dec 2013 21:12:41 +0700")
Duy Nguyen <pclouds@gmail.com> writes:
> I've got a better version [1] that fixes everything I can think of
> (there's still some room for improvements). I'm going to use it a bit
> longer before reposting again. But here's its basic design without
> going down to code
>
> New .git file format includes two lines:
> -- 8< --
> gitid: <id>
> gitdir: <path>
> -- 8< --
>
> Which would set $GIT_COMMON_DIR to <path> and $GIT_DIR to
> <path>/repos/<id>. Repository split is the same as before, worktree
> stuff in $GIT_DIR, the rest in $GIT_COMMON_DIR. This .git file format
> takes precedence over core.worktree but can still be overriden with
> $GIT_WORK_TREE. The main interface to create new worktree is "git
> checkout --to".
>
> "repos" belongs to $GIT_COMMON_DIR (i.e. shared across all checkouts).
> The new worktrees (which I call "linked checkouts") can also access
> HEAD of the original worktree via a virtual path "main/HEAD". This
> makes it possible for a linked checkout to detach HEAD of the main
> one.
I am not happy with the choice of "main/HEAD" that would squat on a
good name for remote-tracking branch (i.e. s/origin/main/), though.
$GIT_DIR/COMMON_HEAD perhaps?
> The interesting thing is support for third party scripts (or hooks,
> maybe) so that they could work with both old and new git versions
> without some sort of git version/feature detection. Of course old git
> versions will only work with ordinary worktrees. To that end, "git
> rev-parse --git-dir" behavior could be changed by two environment
> variables. $GIT_ONE_PATH makes 'rev-parse --git-dir' return the .git
> _file_ in this case, which makes it much easier to pass the repo's
> checkout view around with "git --git-dir=... ".$GIT_COMMON_DIR_PATH
> makes 'rev-parse --git-dir' return $GIT_COMMON_DIR if it's from a
> linked checkout, or $GIT_DIR otherwise.
I do not understand why you need to go such a route.
Existing scripts that works only in a real repository will only know
"git rev-parse --git-dir" as the way to get the real GIT_DIR and
would not care about the "common" thing. Scripts updated to work
well with the "common" thing needs to be aware of the "common" thing
anyway, so adding "git rev-parse --common-git-dir" or somesuch that
only these updated knows would be sufficient, no?
next prev parent reply other threads:[~2013-12-20 20:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-19 14:12 [PATCH v2 00/21] Support multiple worktrees Duy Nguyen
2013-12-20 20:32 ` Junio C Hamano [this message]
2013-12-21 2:00 ` Duy Nguyen
2013-12-22 6:38 ` Junio C Hamano
2013-12-22 8:44 ` Duy Nguyen
2013-12-26 17:12 ` Junio C Hamano
2013-12-28 2:46 ` Duy Nguyen
-- strict thread matches above, loose matches on Subject: below --
2013-12-11 14:15 [PATCH/POC 0/7] " Nguyễn Thái Ngọc Duy
2013-12-14 10:54 ` [PATCH v2 00/21] " Nguyễn Thái Ngọc Duy
2013-12-15 2:29 ` Duy Nguyen
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=xmqq7gaze00k.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.