AgeCommit message (Collapse)AuthorLines
Keep the query string across the about redirectsBryce Kwon-4/+9
The hop to the trailing-slash form of the about page, and the hop back to the summary of a repository without a readme, were built from the path alone, so a request for the about page of another branch landed on the default one. The query goes into the Location line as the client sent it, with any byte a header cannot carry percent-encoded.
Keep clone files and oversized responses out of the cacheBryce Kwon-6/+10
The dumb transport reads files that already sit on the disk, so a pack copied into a slot cost that disk twice and the request a second write of every byte. A snapshot took a slot whatever its size, so a visitor naming distinct refs and ids could fill the cache root with archives. `cache-max-slot-size`, 64 MB unless set, now serves a larger response from the lock file and drops it, along with any expired copy it would have replaced.
Harden the request path, scan and error recoveryBryce Kwon-1/+1
Clean up the whole treeBryce Kwon-9/+8
Fold `enable-stats` back into `max-stats`Bryce Kwon-1/+1
A `max-stats` period enables the page again, as it did before v2.2.0, so one key does both jobs.
Use standard HTTP reason phrasesBryce Kwon-2/+2
Mark the cache listing untrustedBryce Kwon-0/+4
Remove the repository homepage featureBryce Kwon-2/+0
Restyle the sources and fix the audit's findingsBryce Kwon-77/+85
Settle the names, types and layout of the sourcesBryce Kwon-7/+6
Drop the help tab and its built-in guideBryce Kwon-10/+0
Gate the stats page and add a language breakdownBryce Kwon-1/+4
`max-stats` only bounds the selectable periods now and no longer doubles as the enable switch. The tree walk runs before the history walk on purpose. Releasing commit memory while walking history resets each commit slab index, and a commit graph lookup afterwards would read another commit slot and walk the wrong tree. The stats fixture writes a commit graph so the tests cover that path. The history walk bounds the window in process rather than passing a formatted since date to `setup_revisions`, and parses each commit once.
Add a help page with common workflowsBryce Kwon-0/+10
Point the fork's links and credits at itselfBryce Kwon-1/+1
AUTHORS now records the upstream developers as the project's history rather than as maintainers of the fork.
Tolerate a missing or empty repository URLBryce Kwon-1/+2
`trim_end()` returns NULL when a repo url is empty or all slashes and the later newline trim dereferenced it. The legacy `r=` and `p=about` path also read the last byte of the url without checking it was set.
Gate the cache listing behind `enable-cache-list`Bryce Kwon-0/+6
The `ls_cache` page printed the cache directory path and the urls other visitors had requested, with no gate at all.
Reorganize into source, assets and librariesBryce Kwon-0/+0
The C sources move to source/, the served files to assets/, the bundled Git submodule to libraries/git and the filter scripts to extensions/. Everything the build generates now lands in build/, so a clean is a single remove and the tree stays clean.
global: replace references to 'sha1' with 'oid'Christian Hesse-9/+9
For some time now sha1 is considered broken and upstream is working to replace it with sha256. Replace all references to 'sha1' with 'oid', just as upstream does. Signed-off-by: Christian Hesse <mail@eworm.de>
ui-tree: allow per repository override for enable-blameChristian Hesse-1/+1
The blame operation can cause high cost in terms of CPU load for huge repositories. Let's add a per repository override for enable-blame. Signed-off-by: Christian Hesse <mail@eworm.de>
ui-blame: add blame UIJeff Smith-1/+11
Implement a page which provides the blame view of a specified file. This feature is controlled by a new config variable, "enable-blame", which is disabled by default. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
about: path_info might not be validJason A. Donenfeld-1/+2
cmd: redirect empty about/ to homepage or summaryJason A. Donenfeld-1/+10
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
cmd: fix resource leak: free allocation from cgit_currenturl and fmtallocChristian Hesse-3/+7
Signed-off-by: Christian Hesse <mail@eworm.de>
cmd: fix command definitionJohn Keeping-1/+1
The previous commit removed the "pre" field from "struct cgit_cmd" but forgot to update this macro. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
cmd: no need for pre function hook nowJason A. Donenfeld-15/+9
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
cmd: remove "want_layout" fieldJohn Keeping-24/+24
No commands use this any more. Signed-off-by: John Keeping <john@keeping.me.uk>
tree: move layout into page functionJohn Keeping-1/+1
This also allows us to return proper HTTP error codes when the requested tree is not found and display an error message in one case (invalid path inside valid commit) where we previously just displayed an empty page. Signed-off-by: John Keeping <john@keeping.me.uk>
tag: move layout into page functionJohn Keeping-1/+1
This also allows us to return proper HTTP error codes when something goes wrong. Signed-off-by: John Keeping <john@keeping.me.uk>
summary: move layout into page functionJohn Keeping-1/+1
Signed-off-by: John Keeping <john@keeping.me.uk>
stats: move layout into page functionJohn Keeping-1/+1
This also allows us to return proper HTTP error codes for invalid requests. Signed-off-by: John Keeping <john@keeping.me.uk>
refs: move layout to page functionJohn Keeping-1/+1
Signed-off-by: John Keeping <john@keeping.me.uk>
log: move layout into page functionJohn Keeping-1/+1
Signed-off-by: John Keeping <john@keeping.me.uk>
diff: move layout to page functionJohn Keeping-1/+1
The existing "show_ctrls" flag is used to control whether we are running in an existing page or control the page ourselves. Signed-off-by: John Keeping <john@keeping.me.uk>
commit: move layout into page functionJohn Keeping-1/+1
This allows us to return a proper HTTP status code when an object is not found by switching from cgit_print_error() to cgit_print_error_page(). Signed-off-by: John Keeping <john@keeping.me.uk>
about: move layout into page functionsJohn Keeping-1/+1
Signed-off-by: John Keeping <john@keeping.me.uk>
redirect: be more careful for different cgi setupsJason A. Donenfeld-1/+4
about: always ensure page has a trailing slashJason A. Donenfeld-2/+10
Otherwise we can't easily embed links to other /about/ pages. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Remove unused parameter from cgit_print_snapshot()Lukas Fleischer-1/+1
Switch to exclusively using global ctxLukas Fleischer-51/+51
Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_print_http_headers() * cgit_print_docstart() * cgit_print_pageheader() Remove context parameter from all commands Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_get_cmd() * All cgit command functions. * cgit_clone_info() * cgit_clone_objects() * cgit_clone_head() * cgit_print_plain() * cgit_show_stats() In initialization routines, use the global context variable instead of passing a pointer around locally. Remove callback data parameter for cache slots This is no longer needed since the context is always read from the global context variable. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Update copyright informationLukas Fleischer-2/+1
* Name "cgit Development Team" as copyright holder to avoid listing every single developer. * Update copyright ranges. Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
Allow for creating patch seriesLukas Fleischer-1/+1
This allows for specifying a revision range using the id2 parameter of /patch/. The output that is produced is similar to $ git format-patch --stdout id2..id Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
cmd.c: Add a "rawdiff" commandLukas Fleischer-0/+6
This can be used to generate raw diffs between arbitrary revisions using something like /rawdiff/?id=v0.9&id2=v0.9.1 Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Allow for creating raw diffs with cgit_print_diff()Lukas Fleischer-1/+1
This adds a parameter to cgit_print_diff() to create raw diffs, using the same format as `git diff <commit>`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
readme: use string_list instead of space deliminationsJason A. Donenfeld-1/+2
Now this is possible in cgitrc - readme=:README.md readme=:readme.md readme=:README.mkd readme=:readme.mkd readme=:README.rst readme=:readme.rst readme=:README.html readme=:readme.html readme=:README.htm readme=:readme.htm readme=:README.txt readme=:readme.txt readme=:README readme=:readme readme=:INSTALL.txt readme=:install.txt readme=:INSTALL readme=:install Suggested-by: John Keeping <john@keeping.me.uk> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
White space around control verbs.Jason A. Donenfeld-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
ui-log: Add "commit-sort" option for controlling commit orderingTobias Bieniek-1/+2
This makes it possible to use strict commit date ordering or strict topological ordering by passing the corresponding flags to "git log". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
ui-diff.c: create a control panel for diff optionsLars Hjemli-1/+1
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Add is_clone flag to available commandsDan McGee-21/+21
This will be used to make these operations configurable via a config option. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
ui-log: Line-wrap long commit subjects when showmsg is enabledJohan Herland-1/+2
When showmsg is disabled ui-log truncates long commit subjects. This is good. However, the same is not desirable when showmsg is enabled, since you then end up with a truncated commit subject followed by the rest of the commit message below. Instead, when showmsg is enabled (and we're using all this space to display the entire commit message, anyway), line-wrap the commit subject instead of truncating it. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
ui-patch: Apply path limit to generated patchJohan Herland-1/+1
Also indicate in the comment section of the patch that a path limit was applied, too easily see when a generated patch is only partial. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>