On Sat, Jul 16, 2016 at 12:59 AM, Richard Maw <richard....@gmail.com> wrote: > - > - ref = resolve_ref_unsafe("HEAD", 0, sha1, NULL); > - if (!ref || !starts_with(ref, "refs/heads/")) > + char *namespaced_head = NULL; > + > + if (get_git_namespace()) > + namespaced_head = mkpathdup("%sHEAD", get_git_namespace()); > + /* NOTE: RESOLVE_REF_NO_RECURSE is required to prevent it resolving > HEAD > + into a ref outside of the namespace. */ > + ref = resolve_ref_unsafe(namespaced_head ?: "HEAD", > RESOLVE_REF_NO_RECURSE, sha1, NULL);
Except now, for the non-namespaced case, we don't recurse on symbolic entries, which might not be desirable. Rather than this, would it be possible to make the underlying upstream function namespace aware? By the environment variable perhaps? > + free(namespaced_head); > + if (!ref || !starts_with(strip_namespace(ref), "refs/heads/")) > return "master"; > - return xstrdup(ref + 11); > + return xstrdup(strip_namespace(ref) + 11); > } > /* The caller must free filename and ref after calling this. */ > static inline void parse_readme(const char *readme, char **filename, char > **ref, struct cgit_repo *repo) _______________________________________________ CGit mailing list CGit@lists.zx2c4.com http://lists.zx2c4.com/mailman/listinfo/cgit