[PATCH 00/17] Add support for namespaced repositories
Richard Maw
richard.maw at gmail.com
Sat Jul 2 21:28:09 CEST 2016
These patches are to support viewing the namespaces of a git repository
as independent git repositories.
You might want to do this for projects that share a lot of history
(e.g. systemd, udev and eudev), or to permit a user to "fork" a repository
so users on the same server can cheaply copy a large repository
to follow a GitHub-like pull-request process.
Namespace support in git isn't perfect,
only supporting enough operations for the recieve-pack and upload-pack commands.
This is enough to push to and pull from,
but not for viewing a namespaced repository's contents,
so this requires more work than just setting GIT_NAMESPACE.
This has been tested with browsing repositores,
cloning them over the dumb-http protocol
and downloading a snapshot of a namespaced tag.
As well as adding "repo.namespace",
this patch series adds "repo.agefile"
so that namespaced repositories can have their own age files,
and modifications to the contributed agefile post-receive hook.
Some ideas of other potentially useful changes related to namespaces include:
1. Being able to set a default namespace globally.
You might decide to put eveything in a namespace by default
so that you can have additional namespaces alongside
rather than inside the default namespace.
2. Displaying git notes for all subnamespaces
I had to make some changes to avoid displaying notes of the root namespace
in other namespaces.
I made it only display the commit notes for the current namespace,
but since you can see all commits in subnamespaces,
it might make sense to include those notes as well.
3. Automatic discovery of namespaces with scan-path
For a namespace to be useful it needs a HEAD symbolic ref.
From what I can tell this is always unpacked on-disk,
so it would be possible to extend the scan-path logic to look for HEADs.
4. Smarter handling of README files.
The repo.readme option lets you specify a readme as ref:file/path,
so you could show the readme by prepending the namespace's base ref,
but it might be better to have CGit do the prepending.
Richard Maw (17):
Fix qry.head leak on error
Fix archive generation
Add a wrapper for get_sha1 called cgit_get_sha1
Parse repo.namespace
Print out parsed namespace on request
Set GIT_NAMESPACE when repo.namespace is provided
Look up refs in namespace with cgit_get_sha1
Guess the default branch based on current namespace
Add cgit_for_each_namespaced_ref_in helper
Find the default branch based on the contents of the namespace
Only display refs in current namespace
Add namespace support to dumb-clone
Display notes from namespace
Add documentation for repo.namespace
Allow agefile to be set per-repository
Update contrib script to update agefiles per namespace
Add documentation for repo.agefile
cgit.c | 71 ++++++++++++++++++++++++++++++++------
cgit.h | 6 ++++
cgitrc.5.txt | 46 ++++++++++++++++++++++++
contrib/hooks/post-receive.agefile | 15 +++++++-
shared.c | 60 ++++++++++++++++++++++++++++++++
ui-blob.c | 6 ++--
ui-clone.c | 23 +++++++++++-
ui-commit.c | 2 +-
ui-diff.c | 4 +--
ui-log.c | 2 +-
ui-patch.c | 4 +--
ui-plain.c | 2 +-
ui-refs.c | 6 ++--
ui-repolist.c | 3 +-
ui-shared.c | 2 +-
ui-snapshot.c | 14 ++++----
ui-tag.c | 2 +-
ui-tree.c | 2 +-
18 files changed, 233 insertions(+), 37 deletions(-)
--
2.9.0
More information about the CGit
mailing list