AgeCommit message (Collapse)AuthorLines
Answer a submodule path with the submoduleBryce Kwon-0/+6
The tree page read the gitlink's commit as a blob, which outside the repository is a bad object id and inside it is the commit's raw text.
Keep the range in a large diff's patch linkBryce Kwon-1/+1
The link named only id, so for a diff between two commits it led to a patch of the newer one alone, and without an id it lost the branch as well and led to the default branch's tip.
Release only finished walks, never cgit's mailmapBryce Kwon-1/+1
release_revisions frees revs->mailmap, and the log page points it at the static list cgit_mailmap returns, so every log of a repository with enable-mailmap aborted. A walk whose setup failed holds commits that are already freed, so releasing it could free them twice.
Print line number anchors through one helperBryce Kwon-0/+7
Print the commit and tag dates through one helperBryce Kwon-0/+6
Print each person through one helperBryce Kwon-0/+7
The log, refs and tag pages no longer open a filter of their own, so they stop including filter.h.
Refuse pathspec magic through one helperBryce Kwon-0/+7
Start each history walk through one helperBryce Kwon-0/+7
Drop the hidden form fields' unused page argumentBryce Kwon-1/+1
Look up a request's commit in one placeBryce Kwon-0/+14
The diff page now names a revision that is no commit the way the request wrote it, as the other pages already did, rather than as the full id it resolved to. The helpers sit beside the error page in ui-shared.c, since shared.c prints nothing.
Open and close each page through the layout callsBryce Kwon-3/+0
Keep the clone row and title docs in the headerBryce Kwon-1/+15
Fold the va_list error page into its one callerBryce Kwon-1/+0
Drop the query-string form of every linkBryce Kwon-3/+1
The virtual root is set from SCRIPT_NAME before cgitrc is read, so it always holds a value and the ?url= and ?r= forms were never reached. The page argument of cgit_add_hidden_formfields fed only the url field, so it is unused until its callers stop passing it.
Trim a snapshot name without reading out of boundsBryce Kwon-1/+2
For a url of .git, or an empty one, repo_basename stepped its index to the byte before its buffer, read it, and would have cleared it had it held a slash. Git's strbuf trims take the same steps safely, and they lift the 1024-byte cap that failed the page for a longer url.
Name the page first in every titleBryce Kwon-0/+1
Summary, about, log, refs, tag and stats pages shared one title, so tabs, history and search results could not tell them apart. Titles now read page, repository and site, with root-title as the site, and the description stays in the meta description, where search engines read it.
Encode repository urls and the feed branchBryce Kwon-2/+10
Links built from the repository url, among them the description link on the index and the Atom and refs links, wrote it as configured, so a name holding a space, '#' or '?' broke them. The feed link in the page head did the same with the branch, which turned a '+' into a space.
Hold object sizes in size_t as git 2.55 doesBryce Kwon-1/+1
Git 2.55 moved object sizes from unsigned long to size_t. The two are the same type on 64-bit hosts, but not on a 32-bit one, where GCC 14 rejects the mismatched pointers, so cgit stopped compiling there.
Hand the about filter the tree url its links needBryce Kwon-0/+8
With nothing below the about page, a readme's relative links have to be written against the tree, and only cgit knows how this site spells the url of a tree page and which ref the readme was read from. Both reach the filter already escaped for a url, built by the same writer as cgit's own links.
Share the max-blob-size check and its refusalBryce Kwon-0/+5
Five copies of the test and four of the error page had to agree by hand. The new check pins the four refusals, which no test covered.
Keep the query string across the about redirectsBryce Kwon-2/+8
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.
Harden the page renderersBryce Kwon-7/+17
Name the tagged object under its full idBryce Kwon-1/+2
Clean up the whole treeBryce Kwon-50/+31
Point clone rows at a url a browser can followBryce Kwon-0/+1
Restyle the sources and fix the audit's findingsBryce Kwon-14/+50
Settle the names, types and layout of the sourcesBryce Kwon-1/+1
Reorganise into source, assets and librariesBryce Kwon-0/+0
Everything the build generates now lands in build/, so a clean is a single remove and the source tree stays free of build output.
cgit: override die routine globallyJason A. Donenfeld-0/+1
We don't get any return value from compile_grep_patterns calling compile_regexp_failed, causing the default die routine to print to stderr and then for cgit to exit ungracefully. Instead override the default die routine to show a normal error page. Perhaps compile_grep_patterns ought to change upstream to return an error. But this commit here will handle future issues as well, so perhaps not a bad idea to do anyway. Link: https://lists.zx2c4.com/pipermail/cgit/2026-March/004982.html Link: https://lists.zx2c4.com/pipermail/cgit/2026-March/004983.html Reported-by: Adrian C. <anrxc@sysphere.org> Reported-by: Aiden Woodruff <aiden@aidenw.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
git: update to v2.45.0Christian Hesse-1/+1
Update to git version v2.45.0, this requires changes for these upstream commits: * 9720d23e8caf4adee44b3a32803a9bb0480118bd date: make DATE_MODE thread-safe Signed-off-by: Christian Hesse <mail@eworm.de>
auth-filter: pass url with query string attachedJason A. Donenfeld-0/+1
Otherwise redirections come out wrong. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
ui-shared: pass separator in to cgit_print_snapshot_links()John Keeping-1/+1
cgit_print_snapshot_links() is almost identical to print_tag_downloads(), so let's extract the difference to a parameter in preparation for removing print_tag_downloads() in the next commit. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
ui-shared: rename parameter to cgit_print_snapshot_links()John Keeping-1/+1
This is expected to be a ref not a hex object ID, so name it more appropriately. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
ui-shared: remove unused parameterJohn Keeping-1/+1
The "head" parameter to cgit_print_snapshot_links() is never used, so remove it. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
Add "snapshot-prefix" repo configurationJohn Keeping-0/+1
Allow using a user-specified value for the prefix in snapshot files instead of the repository basename. For example, files downloaded from the linux-stable.git repository should be named linux-$VERSION and not linux-stable-$VERSION, which can be achieved by setting: repo.snapshot-prefix=linux Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
ui-shared: pass repo object to print_snapshot_links()John Keeping-2/+2
Both call sites of cgit_print_snapshot_links() use the same values for the snapshot mask and repository name, which are derived from the cgit_repo structure so let's pass in the structure and access the fields directly. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
ui-tree: link to blame UI if enabledJeff Smith-0/+3
Create links to the blame page. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
ui-shared: make a char* parameter constJeff Smith-1/+1
All cgit_xxx_link functions take const char* for the 'name' parameter, except for cgit_commit_link, which takes a char* and subsequently modifies the contents. Avoiding the content changes, and making it const char* will avoid the need to make copies of const char* strings being passed to cgit_commit_link. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
ui-tree: move set_title_from_path to ui-sharedJeff Smith-0/+2
The ui-blame code will also need to call set_title_from_path, so go ahead and move it to ui-shared. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk>
Avoid ambiguities when prettifying snapshot namesLukas Fleischer-0/+2
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>
Avoid DATE_STRFTIME for long/short datesJohn Keeping-1/+1
Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping <john@keeping.me.uk>
ui-shared: remove cgit_print_date()John Keeping-1/+0
There are no longer any users of this function. Signed-off-by: John Keeping <john@keeping.me.uk>
ui: show ages in the originator's timezoneJohn Keeping-1/+1
This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping <john@keeping.me.uk>
ui-shared: add cgit_date_mode()John Keeping-0/+1
This returns the correct mode value for use with Git's show_date() based on the current CGit configuration and will be used in the following patches. Signed-off-by: John Keeping <john@keeping.me.uk>
ui-shared: remove "format" from cgit_print_age()John Keeping-1/+1
We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping <john@keeping.me.uk>
Fix missing prototype declarationsPeter Colberg-6/+6
Signed-off-by: Peter Colberg <peter@colberg.org>
ui-shared: return value of cgit_hosturl is not constChristian Hesse-1/+1
Signed-off-by: Christian Hesse <mail@eworm.de>
ui-shared: return value of cgit_currenturl is not constChristian Hesse-1/+1
Signed-off-by: Christian Hesse <mail@eworm.de>
ui-shared: add cgit_print_layout_{start,end}()John Keeping-0/+3
These will avoid needing to call three functions to start page layout in subsequent patches when we move the layout setup into each individual page. Signed-off-by: John Keeping <john@keeping.me.uk>
ui-shared: add cgit_print_error_page() functionJohn Keeping-0/+2
This will allow us to generate error responses with the correct HTTP response code without needing all of the layout boilerplate. Signed-off-by: John Keeping <john@keeping.me.uk>