Note: print_repo() still ignores repo.max-stats and repo.snapshots,
which both requires additional work since these settings are represented
internally as an enum and a bitmap.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This option must be enabled if repo-specific cgitrc files should be
allowed to override any of the 'filter' options.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
When recursively scanning a directory tree looking for git repositories,
cgit will now parse cgitrc files found within such repositories.
The repo-specific config files can include any repo-specific options
except 'repo.url' and 'repo.path'. Also, in such config files the 'repo.'
prefix can not be used, i.e. the valid options then becomes:
* name
* clone-url
* desc
* ower
* defbranch
* snapshots
* enable-log-filecount
* enable-log-linecount
* max-stats
* module-link
* section
* about-filter
* commit-filter
* source-filter
* readme
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
The new function repo_config() is used to handle all 'simple' repo
options, for the following reasons:
* code readability
* parser performance
* upcoming support for repo-local cgitrc files during scanning
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
When no sorting is requested by the client, cgit will now sort by
section name followed by repo name. This allows repos to be registered/
discovered independently of their display order.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
The 'repo.' prefix should be reserved for repo-specific options, but
the option 'repo.group' must still be honored to stay backwards
compatible.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
When generating a hash for caching, ctx.qry.raw is used as key. And
since cgit_parse_url() zero-terminates it's argument (after the repo
path), ctx.qry.raw must xstrdup(ctx.qry.url).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This function is used to read the full content of a textfile into a
newly allocated buffer (with zerotermination).
It replaces the earlier readfile() in scan-tree.c (which was rather
error-prone[1]), and is reused by read_agefile() in ui-repolist.c.
1: No checks for EINTR and EAGAIN, fixed-size buffer
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
If readfile() reads an empty file, fgets() won't truncate the buffer
and it'll still contain the contents of the previously read file.
[lh: fixed similar issue in ui-repolist.c]
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
The querystring_cb() function will be invoked with a NULL value when
the querystring contains a name not followed by a '='. Such a value
used to cause a segfault, which this patch fixes.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
The purpose of the tag page is to print info about a specific tag,
but if no tag was specified on the query-string cgit used to segfault.
With this patch, cgit will fallback to the value of the 'h' parameter
instead (which is never NULL due to prepare_repo_cmd() in cgit.c).
It will now also verify that the specified tagname is in fact a valid
ref in the 'refs/tags/' namespace, i.e. specifying 'id=master' will
trigger a 'Bad tag reference' error.
Noticed-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
When a lightweight tag is referencing a commit object, cgit now uses
the commit date when comparing tag age. Also, the commitdate and author
info is printed in the refs view, making lightweight tags appear similar
to annotated tags.
Signed-off-by: Stefan Bühler <lighttpd@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
When embedded=1, cgit used to ignore the header and footer options.
But honoring these options when embedded=1 makes it possible to "frame"
the html fragment generated by cgit with any kind of static content,
i.e. it should become easier to integrate cgit with site-specfic
layouts.
Original-patch-by: Mark Constable <markc@renta.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgit_print_http_headers() used to do nothing if 'embedded' was
specified in cgitrc, but that was wrong - we never want to skip the
headers when invoked as a CGI app. Sadly, there's no easy way to
detect if we're invoked as a CGI app or if we're invoked by another
CGI app, so for the latter case cgit needs to be invoked with either
--nohttp on the command line or NO_HTTP=1 in the environment.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
These options can be used to execute a filter command on each about-page,
both top-level and for each repository (repo.about-filter can be used
to override the current about-filter).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This change makes it possible to include any number of pages below
the 'about' tab for a repository. The path is assumed to be located
in the same directory as the 'repo.readme' file.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
If e.g. repo.commit-filter is specified as an empty string, this
is now properly handled as disabling the global commit-filter setting
for the current repository.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>