Painless namespaces design

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]