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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Not sure if there's a better fix for this. defbranch is
NULL here on my setup when a crawler hit an invalid URL,
causing strcmp to segfault.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
When composing snapshot file names for a tag with a prefix of the form
v[0-9] (resp. V[0-9]), the leading "v" (resp. "V") is stripped. This
leads to conflicts if a tag with the stripped name already exists or if
there are tags only differing in the capitalization of the leading "v".
Make sure we do not strip the "v" in these cases.
Reported-by: Juuso Lapinlampi <wub@partyvan.eu>
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Otherwise we get the classic Python UTF-8 errors, and the text is all
out of order. While we're at it, switch to python3 so we only have to
support one set of oddball semantics.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Suggested-by: Daniel Campbell <dlcampbell@gmx.com>
Update to git version v2.8.2.
* Upstream commit 1a0c8dfd89475d6bb09ddee8c019cf0ae5b3bdc2 (strbuf: give
strbuf_getline() to the "most text friendly" variant) changed API.
Signed-off-by: Christian Hesse <mail@eworm.de>
The decoration code inside of git returns the decoration type, so
utilize this to create the decoration spans. Additionally, use
prettify_refname(...) to get the shorter name for the ref.
Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
The decoration span does not need to be emited if there aren't
any decorations to show. This modification saves slightly
on bandwidth.
Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
Your mileage may vary, but for me the old icon looks blurry. The new
one is character 0xf08e from OTF font awsome in size 10.
The icon color is black, gray level is adjusted via opacity.
Signed-off-by: Christian Hesse <mail@eworm.de>
This is to fix the case of accessing http://host.com/cgit.cgi/repo.git/plain/
There is code here to make this case work (match_baselen is set to -1
for top-of-the-tree views) but the unsigned to signed comparison was
always false in this case, causing an empty directory listing without
this fix.
Signed-off-by: Joe Anakata <jea-signup-github@anakata.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Git's DATE_STRFTIME ignores the timezone argument and just uses the
local timezone regardless of whether the "local" flag is set.
Since Atom accepts ISO8601 dates [1], we can use Git's
DATE_ISO8601_STRICT instead, which does get this right. Additionally,
we never use the local timezone here so we can use the
date_mode_from_type() wrapper to simplify the code a bit.
[1] https://tools.ietf.org/html/rfc4287#section-3.3
Signed-off-by: John Keeping <john@keeping.me.uk>