aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add documentation for repo.agefilerm/namespaceRichard Maw2016-07-131-0/+14
| | | | Signed-off-by: Richard Maw <richard.maw@gmail.com>
* Update contrib script to update agefiles per namespaceRichard Maw2016-07-131-1/+14
| | | | | | | 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 <richard.maw@gmail.com>
* Allow agefile to be set per-repositoryRichard Maw2016-07-133-1/+5
| | | | | | | | | | This adds "repo.agefile", since namespaced repositories share the same files, and we'd like to be able to see the ages of the refs for each namespace. Whatever the git server uses for updating the age file must be namespace aware and must write the age file to a path consistent with "repo.agefile". Signed-off-by: Richard Maw <richard.maw@gmail.com>
* Add documentation for repo.namespaceRichard Maw2016-07-131-0/+32
| | | | Signed-off-by: Richard Maw <richard.maw@gmail.com>
* Display notes from namespaceRichard Maw2016-07-131-1/+33
| | | | | | | | | | | | | | | | | | We must not leave it at its default behaviour, as that results in notes from the root namespace being used and ignoring notes from the current namespace, since it is not namespace aware. We can handle this by instructing it to not load the default refs, and providing a set of extra refs to use. 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 <richard.maw@gmail.com>
* Add namespace support to dumb-cloneRichard Maw2016-07-131-1/+22
| | | | | | | | | | | 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 <richard.maw@gmail.com>
* Only display refs in current namespaceRichard Maw2016-07-131-3/+3
| | | | Signed-off-by: Richard Maw <richard.maw@gmail.com>
* Find the default branch based on the contents of the namespaceRichard Maw2016-07-131-1/+1
| | | | | | | | 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 <richard.maw@gmail.com>
* Add cgit_for_each_namespaced_ref_in helperRichard Maw2016-07-132-0/+12
| | | | | | | | | | | 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 <richard.maw@gmail.com>
* Guess the default branch based on current namespaceRichard Maw2016-07-131-4/+10
| | | | | | | | | | | | resolve_ref_unsafe() can't be told to be namespace aware, so we need to prepend the namespace beforehand. Additionally, we need to add the RESOLVE_REF_NO_RECURSE flag, since otherwise if the commit that is pointed to exists in the root namespace, it will opt to return that rather than the value in the namespace, presumably preferring shorter ref names to longer ones. Signed-off-by: Richard Maw <richard.maw@gmail.com>
* Look up refs in namespace with cgit_get_sha1Richard Maw2016-07-131-1/+46
| | | | | | | | | | | | | This causes all ref resolving to look for the requested branch inside the current namespace. Previously any form of git revision would be accepted, but ref resolving isn't namespace aware and it would be infeasible to replicate all its behaviour, so we stick to providing the most common cases of a sha1, an absolute ref, or a partial ref. Signed-off-by: Richard Maw <richard.maw@gmail.com>
* Set GIT_NAMESPACE when repo.namespace is providedRichard Maw2016-07-131-0/+5
| | | | | | | | | | | 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 <richard.maw@gmail.com>
* Print out parsed namespace on requestRichard Maw2016-07-131-0/+2
| | | | | | | | | 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 <richard.maw@gmail.com>
* Parse repo.namespaceRichard Maw2016-07-132-0/+3
| | | | | | | | | | | | | | This contains the unexpanded name of the namespace rather than the base ref of the namespace, since the git namespace mechanism works by setting GIT_NAMESPACE and on the first call to get_git_namespace() it gets expanded. We need to save this for a later call to prepare_repo_cmd, rather than 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 <richard.maw@gmail.com>
* Add a wrapper for get_sha1 called cgit_get_sha1Richard Maw2016-07-1313-22/+29
| | | | | | | 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 <richard.maw@gmail.com>
* Fix archive generationRichard Maw2016-07-131-2/+2
| | | | | | | | | | | | | | | | The get_ref_from_filename function is expected to return a sha1. It didn't actually do this, instead returning the ref that would under normal circumstances resolve to that. Since we're going to resolve refs in a way that is namespace aware we need to return the sha1 rather than the 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 <richard.maw@gmail.com>
* Fix qry.head leak on errorRichard Maw2016-07-121-4/+4
This is run soon before exiting so it wasn't leaked for long. Signed-off-by: Richard Maw <richard.maw@gmail.com>