git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: gc and repack ignore .git/*HEAD when checking reachability
Date: Fri, 15 Jul 2016 17:46:42 +0200	[thread overview]
Message-ID: <CACsJy8At1FLhpcbtaYe-=Fpf4d5AZLKxr8rMoV62ZY+Tk=68Cw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1607132055090.6426@virtualbox>

On Wed, Jul 13, 2016 at 8:59 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>> No.
>
> Oh? So you do not see that we are already heading into serious trouble
> ourselves?

I do see problems, that have solutions. But I have not yet seen that
we are heading to a dead end.

>> I prefer we have a single interface for dealing with _any_ worktree.
>
> I agree. So far, I did not see an interface, though, but the idea that we
> should somehow fake things so that there does not *have* to be an
> interface.

Calling it "fake" is a bit too strong. I'd call it an abstraction. We
have always had the one-repo/one-worktree relationship, now we're
breaking that assumption. Some operations work at repo level and
require a "repo view" while others work at worktree level. We do it in
a way that a program designed with these separate views can still work
correctly in the traditional one-worktree-one-repo configuration,
where both views are the same.

 - For accessing data in $GIT_DIR, you do not peek directly into it
any more. You use "git rev-parse --git-path" to retrieve a path in
$GIT_DIR (instead of doing `git rev-parse --git-dir`/some/path), then
you can do something about it. This is the equivalent of git_path() at
C level.

 - We have a set of rules to define what part of $GIT_DIR is shared
and what is not. When you add new stuff and follow this rule, it will
work in single or multiple worktree config. So far pretty much every
unknown thing is per-worktree. $GIT_DIR/common will be the shared
place for external scripts, soon.

 - It's the same thing for refs: we may reserve a portion of it for
per-worktree, and the rest is shared.

 - We provide means for one worktree to access data of any other
worktree if needed (e.g. $GIT_COMMON_DIR, or the new ref storage API)

 - Because the majority of operations is per-worktree, that has been
the default view so far when working in multiple worktrees. Repo-level
operations such as git-gc, rev-list --all, fsck... need to "switch
view". I missed this and this seemed to cause big problem for you. My
only excuse is, this is an experimental feature.

The idea of single config file with separate "worktree namespace" (eg.
core.worktree vs worktree.<abc>.worktree) was shot down because it
would result in a lot of changes. And it's the same thing why we start
to split views this way (and make default view "per-worktree") instead
of rewriting every piece of code to deal with multiple worktrees
explicitly (by carrying the worktree id everywhere).

There are two loose ends that are on my mind, but I have not clear
ideas yet: the incorporation of ref namespace and odb alternates.
Imagine when you you submodules, all submodule repos (refs and odb)
can be stored in the top-level .git repo, separated by namespaces.
After all a repo is just a container, of a bunch of refs. This make it
much easier to peek into another submodule from a supermodule, and
makes it safer to "rm -r a-submodule" when you get mad at something.

I hope this shows that it is less of a fake thing.
-- 
Duy

      reply	other threads:[~2016-07-15 15:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08  2:59 gc and repack ignore .git/*HEAD when checking reachability Josh Triplett
2016-07-08  4:34 ` Junio C Hamano
2016-07-08  6:44   ` Josh Triplett
2016-07-08 17:14     ` Junio C Hamano
2016-07-08 19:25       ` Theodore Ts'o
2016-07-08 20:30         ` Junio C Hamano
2016-07-08 23:50           ` Theodore Ts'o
2016-07-09  5:23             ` Josh Triplett
2016-07-08 20:29       ` Josh Triplett
2016-07-09  7:35       ` Johannes Schindelin
2016-07-09 14:09         ` Josh Triplett
2016-07-09 16:45           ` Duy Nguyen
2016-07-10 10:59             ` Johannes Schindelin
2016-07-10 11:04               ` Duy Nguyen
2016-07-10 14:16                 ` Johannes Schindelin
2016-07-10 15:01                   ` Duy Nguyen
2016-07-11  6:07                     ` Johannes Schindelin
2016-07-11 18:52                   ` Junio C Hamano
2016-07-12 10:47                     ` Johannes Schindelin
2016-07-12 15:26                       ` Jeff King
2016-07-12 15:46                         ` Duy Nguyen
2016-07-12 15:51                           ` Jeff King
2016-07-12 16:13                             ` Duy Nguyen
2016-07-13  8:20                               ` Johannes Schindelin
2016-07-13 14:54                                 ` Duy Nguyen
2016-07-13 18:59                                   ` Johannes Schindelin
2016-07-15 15:46                                     ` Duy Nguyen [this message]

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='CACsJy8At1FLhpcbtaYe-=Fpf4d5AZLKxr8rMoV62ZY+Tk=68Cw@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=josh@joshtriplett.org \
    --cc=peff@peff.net \
    /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).