All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiang Xin <worldhello.net@gmail.com>
To: Jamey Sharp <jamey@minilop.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>, Jakub Narebski <jnareb@gmail.com>,
	Bert Wesarg <bert.wesarg@googlemail.com>,
	git@vger.kernel.org
Subject: Painless namespaces design
Date: Wed, 15 Jun 2011 19:18:21 +0800	[thread overview]
Message-ID: <4DF894FD.9040808@gmail.com> (raw)
In-Reply-To: <1307487890-3915-1-git-send-email-jamey@minilop.net>

I like the idea of new namespaces feature from Josh Triplett, Jamey Sharp and others.
I think it is better to pass namespace through remote.remote-name.namespace variables,
not through GIT_NAMESPACE environment.

Host1 has a bare repository with multiple namespaces: foo, bar, and foo/baz.

* master branch of default namespace : refs/heads/master
* master branch of namespace foo is : refs/namespaces/foo/refs/heads/master
* master branch of namesapce bar is : refs/namespaces/bar/refs/heads/master
* master branch of namesapce foo/baz is : refs/namespaces/foo/refs/namespaces/baz/refs/heads/master

UserA clone namespace foo from Host1:

    $ git clone --namespace foo ssh://Host1/path/to/project.git

the default remote.origin section in  .git/config in userA's working directory:

    [remote "origin"]
        namespace = foo
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = ssh://Host1/path/to/project.git

When UserA runs `git fetch`, it's just like

    git fetch origin refs/namespaces/foo/refs/heads/*:refs/remotes/origin/*

When UserA runs `git push`, it's just like

    git push origin refs/heads/master:refs/namespaces/foo/refs/heads/master

These can be done on the client side, so I think there is no necessary to hack
git-receive-pack and git-upload-pack.

Refs of namespace foo/baz not cloned by UserA by default, so name space baz
does not exists in UserA's new cloned repository.

If UserA wants to watch some commits on other namespace in project.git in Host1,
UserA can do this:

    $ git remote add --namespace bar  host1bar  ssh://Host1/path/to/project.git

Then there is a new remote section in .git/config file in UserA's working directory.

    [remote "host1bar"]
        namespace = bar
        fetch = +refs/heads/*:refs/remotes/host1bar/*
        url = ssh://Host1/path/to/project.git

When UserA runs git fetch host1bar, then:

    refs/namespaces/bar/refs/heads/master [remote] => refs/remotes/host1bar/master [local]

When UserA execute `git ls-remote host1bar`, only show references under  refs/namespaces/bar/refs/
of remote Host1.

To mirror all namespaces of project.git in Host1, run this command:

    git clone --mirror ssh://Host1/path/to/project.git


I believe this design is painless for both git server and client side tools.

Topgit is one of my daily use tools. Without namespaces feature, I have to create new repositories
to track develop status. It is because the develop status of a topgit controlled repository
is not through one certain branch, but through all the topic branches (refs/heads/t/*) and their
base branches (refs/top-bases/t/*).

I'd like to see namespaces feature becomes one part of git.


于 11-6-8 上午7:04, Jamey Sharp 写道:
> This series adds support for dividing the refs of a single repository
> into multiple namespaces, each of which can have its own branches, tags,
> and HEAD. Git can expose each namespace as an independent repository to
> pull from and push to, while sharing the object store, and exposing all
> the refs to operations such as git-gc.
> 

-- 
Jiang Xin

  parent reply	other threads:[~2011-06-15 11:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 23:04 [PATCHv8 0/4] Support ref namespaces Jamey Sharp
2011-06-07 23:04 ` [PATCHv8 1/4] Fix prefix handling in ref iteration functions Jamey Sharp
2011-06-08  0:17   ` Junio C Hamano
2011-06-08  1:40     ` Josh Triplett
2011-06-07 23:04 ` [PATCHv8 2/4] Add infrastructure for ref namespaces Jamey Sharp
2011-06-07 23:04 ` [PATCHv8 3/4] Support ref namespaces for remote repositories via upload-pack and receive-pack Jamey Sharp
2011-06-07 23:04 ` [PATCHv8 4/4] Add documentation for ref namespaces Jamey Sharp
2011-06-08 15:19   ` Marc Branchaud
2011-06-15 11:18 ` Jiang Xin [this message]
2011-06-15 14:00   ` Painless namespaces design Shawn Pearce

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=4DF894FD.9040808@gmail.com \
    --to=worldhello.net@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jamey@minilop.net \
    --cc=jnareb@gmail.com \
    --cc=peff@peff.net \
    --cc=spearce@spearce.org \
    /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.