[PATCH v3 20/21] Update contrib script to update agefiles per namespace

2016-08-01 Thread Richard Maw
This uses the same age file as before if it's in the root namespace, but puts the agefile in info/web/namespaces/$GIT_NAMESPACE/last-modified. Signed-off-by: Richard Maw --- contrib/hooks/post-receive.agefile | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --

[PATCH v3 10/21] Use cgit_namespaced_dwim_ref for finding logs to show

2016-08-01 Thread Richard Maw
This replaces the previous behaviour of disambiguate_ref, which would only prepend refs/heads to the branch name, so would not disambiguate tags to their full refs. Now when an abbreviated ref is provided the namespace is prepended to it as well as the disambiguating path. Signed-off-by: Richard

[PATCH v3 06/21] Set GIT_NAMESPACE when repo.namespace is provided

2016-08-01 Thread Richard Maw
This causes any namespace-aware code to only handle refs under that namespace. Currently this doesn't do much as the only namespace aware code is in recieve-pack and upload-pack, which are not handled by CGit. Signed-off-by: Richard Maw --- cgit.c | 5 + 1 file changed, 5 inser

[PATCH v3 08/21] Add cgit_namespaced_dwim_ref for resolving short refs

2016-08-01 Thread Richard Maw
resolving to libgit, so this implements a subset of the ref parsing logic, which we'll need to parse branches in links. Signed-off-by: Richard Maw --- cgit.h | 2 ++ shared.c | 45 + 2 files changed, 47 insertions(+) diff --git a/cgit.h b/cgit.h

[PATCH v3 19/21] Allow agefile to be set per-repository

2016-08-01 Thread Richard Maw
h "repo.agefile". Signed-off-by: Richard Maw --- cgit.c| 2 ++ cgit.h| 1 + ui-repolist.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index 321a00f..f7df288 100644 --- a/cgit.c +++ b/cgit.c @@ -88,6 +88,8 @@ static void rep

[PATCH v3 14/21] Find the default branch based on the contents of the namespace

2016-08-01 Thread Richard Maw
The find_current_ref callback does not need to be modified to strip off the namespace prefix, since the for_each_ref functions don't include the base ref prefix. Signed-off-by: Richard Maw --- cgit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c

[PATCH v3 12/21] Guess the default branch based on current namespace

2016-08-01 Thread Richard Maw
-pack is not so tolerant, so try to avoid having such broken repos. Signed-off-by: Richard Maw --- cgit.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cgit.c b/cgit.c index 5d55187..7b499ea 100644 --- a/cgit.c +++ b/cgit.c @@ -472,13 +472,18 @@ static char *find

[PATCH v3 04/21] Parse repo.namespace

2016-08-01 Thread Richard Maw
trying to process it here, since we can only do it once, and we have other uses for the unexpanded name. Signed-off-by: Richard Maw --- cgit.c | 2 ++ cgit.h | 1 + 2 files changed, 3 insertions(+) diff --git a/cgit.c b/cgit.c index 3763a30..304027c 100644 --- a/cgit.c +++ b/cgit.c @@ -45,6 +45,8

[PATCH v3 03/21] Add a wrapper for get_sha1 called cgit_get_sha1

2016-08-01 Thread Richard Maw
This will later be changed to include namespace resolution, but the call sites are changed now to keep the changes small. Signed-off-by: Richard Maw --- cgit.c| 2 +- cgit.h| 2 ++ shared.c | 5 + ui-blob.c | 6 +++--- ui-commit.c | 2 +- ui-diff.c | 4

[PATCH v3 09/21] Look up refs in namespace with cgit_get_sha1

2016-08-01 Thread Richard Maw
es of a sha1, an absolute ref, or a partial ref. Signed-off-by: Richard Maw --- shared.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/shared.c b/shared.c index 77cb120..4c7bb9c 100644 --- a/shared.c +++ b/shared.c @@ -669,5 +669,19 @@ int cgit_namespaced_dwim_ref(const char

[PATCH v3 13/21] Add cgit_for_each_namespaced_ref_in helper

2016-08-01 Thread Richard Maw
libgit has a for_each_namespaced_ref, but lacks equivalents for just branches, tags or remotes. Rather than implementing all of those helpers, it's more convenient to implement just one that prepends the namespace to the provided ref base. Signed-off-by: Richard Maw --- cgit.h

[PATCH v3 15/21] Only display refs in current namespace

2016-08-01 Thread Richard Maw
Signed-off-by: Richard Maw --- ui-refs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-refs.c b/ui-refs.c index 75f2789..3e4edad 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -183,9 +183,9 @@ void cgit_print_branches(int maxcount) list.refs = NULL

[PATCH v3 17/21] Display notes from namespace

2016-08-01 Thread Richard Maw
. The provided extra refs are globs rather than ref names, but ref names may not contain glob characters so this is safe. We get an annoying warning if the provided ref does not exist, so we check whether the ref exists before attempting to provide it. Signed-off-by: Richard Maw --- cgit.c | 21

[PATCH v3 11/21] Render commit decorations correctly

2016-08-01 Thread Richard Maw
sification is not namespace aware, so they need to be re-classified for HEAD and branches to be rendered. Signed-off-by: Richard Maw --- ui-log.c | 30 ++ 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ui-log.c b/ui-log.c index 71ef3d4..fda2523 10064

[PATCH v3 18/21] Add documentation for repo.namespace

2016-08-01 Thread Richard Maw
Signed-off-by: Richard Maw --- cgitrc.5.txt | 33 + 1 file changed, 33 insertions(+) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 9fcf445..0de14a4 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -570,6 +570,11 @@ repo.max-stats:: repo.name:: The value

[PATCH v3 21/21] Add documentation for repo.agefile

2016-08-01 Thread Richard Maw
Signed-off-by: Richard Maw --- cgitrc.5.txt | 14 ++ 1 file changed, 14 insertions(+) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 0de14a4..644e0ef 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -468,6 +468,10 @@ repo.about-filter:: Override the default about-filter

[PATCH v3 16/21] Add namespace support to dumb-clone

2016-08-01 Thread Richard Maw
This requires namespacing the HEAD symbolic ref and the list of refs. Sending HEAD required some tweaking, since the file itself refers to a namespaced ref, but we want to provide the ref with its namespace stripped off. Signed-off-by: Richard Maw --- ui-clone.c | 18 -- 1 file

[PATCH v3 07/21] Add namespaced resolve ref helper

2016-08-01 Thread Richard Maw
Unlike resolve_ref_unsafe, this does not return a substring or static buffer. This is because the ref including the namespace can be longer. Signed-off-by: Richard Maw --- cgit.h | 2 ++ shared.c | 20 2 files changed, 22 insertions(+) diff --git a/cgit.h b/cgit.h index

[PATCH v3 02/21] Fix archive generation

2016-08-01 Thread Richard Maw
ref, since the archive is created by libgit code that is not namespace aware, and it would try to resolve the ref again. This previously worked fine because it would resolve the ref the same way both times. Signed-off-by: Richard Maw --- ui-snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v3 05/21] Print out parsed namespace on request

2016-08-01 Thread Richard Maw
This is not strictly necessary, as we do not have any way to generate namespace entries from a scan-path, but I'd rather not leave this as a surprise to someone who comes up with a good namespace discovery mechanism. Signed-off-by: Richard Maw --- cgit.c | 2 ++ 1 file changed, 2 inser

[PATCH v3 01/21] Return a copy of "master" when guessing defbranch fails

2016-08-01 Thread Richard Maw
tic because the string is not freed. Signed-off-by: Richard Maw --- cgit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index 9427c4a..06c40ef 100644 --- a/cgit.c +++ b/cgit.c @@ -475,7 +475,7 @@ static char *guess_defbranch(void) ref = resolve_ref_u

[PATCH v3 00/21] Add namespace support to cgit

2016-08-01 Thread Richard Maw
dding namespaced functions to libgit later in the week. Richard Maw (21): Return a copy of "master" when guessing defbranch fails Fix archive generation Add a wrapper for get_sha1 called cgit_get_sha1 Parse repo.na

[PATCH 00/16] [V2] Add namespace support to cgit

2016-07-15 Thread Richard Maw
: git://git.gitano.org.uk/cgit.git for you to fetch changes up to 2a20425f4e76e378c138094c79b78aa476c019b5: Add documentation for repo.agefile (2016-07-13 20:09:37 +0100) Richard Maw (16): Fix archive generation Add a wrapper for get_sha1 called cgit_get_sha1 Parse repo.namespace

[PATCH 03/16] Parse repo.namespace

2016-07-15 Thread Richard Maw
trying to process it here, since we can only do it once, and we have other uses for the unexpanded name. Signed-off-by: Richard Maw --- cgit.c | 2 ++ cgit.h | 1 + 2 files changed, 3 insertions(+) diff --git a/cgit.c b/cgit.c index 94d452c..e525264 100644 --- a/cgit.c +++ b/cgit.c @@ -45,6 +45,8

[PATCH 09/16] Find the default branch based on the contents of the namespace

2016-07-15 Thread Richard Maw
The find_current_ref callback does not need to be modified to strip off the namespace prefix, since the for_each_ref functions don't include the base ref prefix. Signed-off-by: Richard Maw --- cgit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c

[PATCH 01/16] Fix archive generation

2016-07-15 Thread Richard Maw
ref, since the archive is created by libgit code that is not namespace aware, and it would try to resolve the ref again. This previously worked fine because it would resolve the ref the same way both times. Signed-off-by: Richard Maw --- ui-snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH 06/16] Look up refs in namespace with cgit_get_sha1

2016-07-15 Thread Richard Maw
es of a sha1, an absolute ref, or a partial ref. Signed-off-by: Richard Maw --- shared.c | 47 ++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/shared.c b/shared.c index d82c07b..81a5cd8 100644 --- a/shared.c +++ b/shared.c @@ -602,7 +6

[PATCH 04/16] Print out parsed namespace on request

2016-07-15 Thread Richard Maw
This is not strictly necessary, as we do not have any way to generate namespace entries from a scan-path, but I'd rather not leave this as a surprise to someone who comes up with a good namespace discovery mechanism. Signed-off-by: Richard Maw --- cgit.c | 2 ++ 1 file changed, 2 inser

[PATCH 05/16] Set GIT_NAMESPACE when repo.namespace is provided

2016-07-15 Thread Richard Maw
This causes any namespace-aware code to only handle refs under that namespace. Currently this doesn't do much as the only namespace aware code is in recieve-pack and upload-pack, which are not handled by CGit. Signed-off-by: Richard Maw --- cgit.c | 5 + 1 file changed, 5 inser

[PATCH 08/16] Add cgit_for_each_namespaced_ref_in helper

2016-07-15 Thread Richard Maw
libgit has a for_each_namespaced_ref, but lacks equivalents for just branches, tags or remotes. Rather than implementing all of those helpers, it's more convenient to implement just one that prepends the namespace to the provided ref base. Signed-off-by: Richard Maw --- cgit.h

[PATCH 07/16] Guess the default branch based on current namespace

2016-07-15 Thread Richard Maw
value in the namespace, presumably preferring shorter ref names to longer ones. Signed-off-by: Richard Maw --- cgit.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cgit.c b/cgit.c index eae2f34..d9fe2b9 100644 --- a/cgit.c +++ b/cgit.c @@ -474,11 +474,17 @@ s

[PATCH 02/16] Add a wrapper for get_sha1 called cgit_get_sha1

2016-07-15 Thread Richard Maw
This will later be changed to include namespace resolution, but the call sites are changed now to keep the changes small. Signed-off-by: Richard Maw --- cgit.c| 2 +- cgit.h| 2 ++ shared.c | 5 + ui-blob.c | 6 +++--- ui-commit.c | 2 +- ui-diff.c | 4

[PATCH 16/16] Add documentation for repo.agefile

2016-07-15 Thread Richard Maw
Signed-off-by: Richard Maw --- cgitrc.5.txt | 14 ++ 1 file changed, 14 insertions(+) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 6116d1b..db22269 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -468,6 +468,10 @@ repo.about-filter:: Override the default about-filter

[PATCH 15/16] Update contrib script to update agefiles per namespace

2016-07-15 Thread Richard Maw
This uses the same age file as before if it's in the root namespace, but puts the agefile in info/web/namespaced/$GIT_NAMESPACE/last-modified. Signed-off-by: Richard Maw --- contrib/hooks/post-receive.agefile | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --

[PATCH 13/16] Add documentation for repo.namespace

2016-07-15 Thread Richard Maw
Signed-off-by: Richard Maw --- cgitrc.5.txt | 32 1 file changed, 32 insertions(+) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 9fcf445..6116d1b 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -570,6 +570,10 @@ repo.max-stats:: repo.name:: The value

[PATCH 11/16] Add namespace support to dumb-clone

2016-07-15 Thread Richard Maw
This requires namespacing the HEAD symbolic ref and the list of refs. Sending HEAD required some tweaking, since the file itself refers to a namespaced ref, but we want to provide the ref with its namespace stripped off. Signed-off-by: Richard Maw --- ui-clone.c | 23 ++- 1

[PATCH 10/16] Only display refs in current namespace

2016-07-15 Thread Richard Maw
Signed-off-by: Richard Maw --- ui-refs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-refs.c b/ui-refs.c index 75f2789..3e4edad 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -183,9 +183,9 @@ void cgit_print_branches(int maxcount) list.refs = NULL

[PATCH 14/16] Allow agefile to be set per-repository

2016-07-15 Thread Richard Maw
h "repo.agefile". Signed-off-by: Richard Maw --- cgit.c| 2 ++ cgit.h| 1 + ui-repolist.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index d428019..a87f245 100644 --- a/cgit.c +++ b/cgit.c @@ -88,6 +88,8 @@ static void rep

[PATCH 12/16] Display notes from namespace

2016-07-15 Thread Richard Maw
. The provided extra refs are globs rather than ref names, so we should escape them to be sure. We get an annoying warning if the provided ref does not exist, so we check whether the ref exists before attempting to provide it. Signed-off-by: Richard Maw --- cgit.c | 34

[PATCH 14/17] Add documentation for repo.namespace

2016-07-02 Thread Richard Maw
Signed-off-by: Richard Maw --- cgitrc.5.txt | 32 1 file changed, 32 insertions(+) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 2e1912d..59127f8 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -570,6 +570,10 @@ repo.max-stats:: repo.name:: The value

[PATCH 16/17] Update contrib script to update agefiles per namespace

2016-07-02 Thread Richard Maw
This uses the same age file as before if it's in the root namespace, but puts the agefile in info/web/namespaced/$GIT_NAMESPACE/last-modified. Signed-off-by: Richard Maw --- contrib/hooks/post-receive.agefile | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --

[PATCH 15/17] Allow agefile to be set per-repository

2016-07-02 Thread Richard Maw
h "repo.agefile". Signed-off-by: Richard Maw --- cgit.c| 2 ++ cgit.h| 1 + ui-repolist.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index d428019..a87f245 100644 --- a/cgit.c +++ b/cgit.c @@ -88,6 +88,8 @@ static void rep

[PATCH 17/17] Add documentation for repo.agefile

2016-07-02 Thread Richard Maw
Signed-off-by: Richard Maw --- cgitrc.5.txt | 14 ++ 1 file changed, 14 insertions(+) diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 59127f8..b449338 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -468,6 +468,10 @@ repo.about-filter:: Override the default about-filter

[PATCH 02/17] Fix archive generation

2016-07-02 Thread Richard Maw
ref, since the archive is created by libgit code that is not namespace aware, and it would try to resolve the ref again. This previously worked fine because it would resolve the ref the same way both times. Signed-off-by: Richard Maw --- ui-snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH 01/17] Fix qry.head leak on error

2016-07-02 Thread Richard Maw
This is run soon before exiting so it wasn't leaked for long. Signed-off-by: Richard Maw --- cgit.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cgit.c b/cgit.c index ab3fadb..9427c4a 100644 --- a/cgit.c +++ b/cgit.c @@ -616,11 +616,11 @@ stati

[PATCH 12/17] Add namespace support to dumb-clone

2016-07-02 Thread Richard Maw
This requires namespacing the HEAD symbolic ref and the list of refs. Sending HEAD required some tweaking, since the file itself refers to a namespaced ref, but we want to provide the ref with its namespace stripped off. Signed-off-by: Richard Maw --- ui-clone.c | 23 ++- 1

[PATCH 13/17] Display notes from namespace

2016-07-02 Thread Richard Maw
. The provided extra refs are globs rather than ref names, so we should escape them to be sure. We get an annoying warning if the provided ref does not exist, so we check whether the ref exists before attempting to provide it. Signed-off-by: Richard Maw --- cgit.c | 34

[PATCH 10/17] Find the default branch based on the contents of the namespace

2016-07-02 Thread Richard Maw
The find_current_ref callback does not need to be modified to strip off the namespace prefix, since the for_each_ref functions don't include the base ref prefix. Signed-off-by: Richard Maw --- cgit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c

[PATCH 09/17] Add cgit_for_each_namespaced_ref_in helper

2016-07-02 Thread Richard Maw
libgit has a for_each_namespaced_ref, but lacks equivalents for just branches, tags or remotes. Rather than implementing all of those helpers, it's more convenient to implement just one that prepends the namespace to the provided ref base. Signed-off-by: Richard Maw --- cgit.h

[PATCH 00/17] Add support for namespaced repositories

2016-07-02 Thread Richard Maw
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

[PATCH 06/17] Set GIT_NAMESPACE when repo.namespace is provided

2016-07-02 Thread Richard Maw
This causes any namespace-aware code to only handle refs under that namespace. Currently this doesn't do much as the only namespace aware code is in recieve-pack and upload-pack, which are not handled by CGit. Signed-off-by: Richard Maw --- cgit.c | 5 + 1 file changed, 5 inser

[PATCH 03/17] Add a wrapper for get_sha1 called cgit_get_sha1

2016-07-02 Thread Richard Maw
This will later be changed to include namespace resolution, but the call sites are changed now to keep the changes small. Signed-off-by: Richard Maw --- cgit.c| 2 +- cgit.h| 2 ++ shared.c | 5 + ui-blob.c | 6 +++--- ui-commit.c | 2 +- ui-diff.c | 4

[PATCH 04/17] Parse repo.namespace

2016-07-02 Thread Richard Maw
trying to process it here, since we can only do it once, and we have other uses for the unexpanded name. Signed-off-by: Richard Maw --- cgit.c | 2 ++ cgit.h | 1 + 2 files changed, 3 insertions(+) diff --git a/cgit.c b/cgit.c index 94d452c..e525264 100644 --- a/cgit.c +++ b/cgit.c @@ -45,6 +45,8

[PATCH 07/17] Look up refs in namespace with cgit_get_sha1

2016-07-02 Thread Richard Maw
es of a sha1, an absolute ref, or a partial ref. Signed-off-by: Richard Maw --- shared.c | 47 ++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/shared.c b/shared.c index d82c07b..81a5cd8 100644 --- a/shared.c +++ b/shared.c @@ -602,7 +6

[PATCH 05/17] Print out parsed namespace on request

2016-07-02 Thread Richard Maw
This is not strictly necessary, as we do not have any way to generate namespace entries from a scan-path, but I'd rather not leave this as a surprise to someone who comes up with a good namespace discovery mechanism. Signed-off-by: Richard Maw --- cgit.c | 2 ++ 1 file changed, 2 inser

[PATCH 11/17] Only display refs in current namespace

2016-07-02 Thread Richard Maw
Signed-off-by: Richard Maw --- ui-refs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-refs.c b/ui-refs.c index 5b4530e..f21797b 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -189,9 +189,9 @@ void cgit_print_branches(int maxcount) list.refs = NULL

[PATCH 08/17] Guess the default branch based on current namespace

2016-07-02 Thread Richard Maw
value in the namespace, presumably preferring shorter ref names to longer ones. Signed-off-by: Richard Maw --- cgit.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cgit.c b/cgit.c index eae2f34..d9fe2b9 100644 --- a/cgit.c +++ b/cgit.c @@ -474,11 +474,17 @@ s

Re: Supporting Namespaces in cgit

2016-06-25 Thread Richard Maw
On Sat, Jun 25, 2016 at 04:46:26PM +0100, Richard Maw wrote: > On Tue, May 10, 2016 at 02:21:36PM +0100, John Keeping wrote: > > On Mon, May 09, 2016 at 10:54:44PM +0100, Daniel Silverstone wrote: > > > On Mon, May 09, 2016 at 22:31:37 +0100, John Keeping wrote: > > >

Re: Supporting Namespaces in cgit

2016-06-25 Thread Richard Maw
Hi all. I thought I'd give an update, since I managed to find time to make an attempt at this. On Tue, May 10, 2016 at 02:21:36PM +0100, John Keeping wrote: > On Mon, May 09, 2016 at 10:54:44PM +0100, Daniel Silverstone wrote: > > On Mon, May 09, 2016 at 22:31:37 +0100, John Keeping wrote: > > >