AgeCommit message (Collapse)AuthorLines
Report a max-stats value that names no periodBryce Kwon-2/+27
A value cgit does not know as a period turns the statistics page off, so a typo such as "decade" read the same as leaving stats off on purpose. The empty value stays quiet because a cached repolist writes it for a repository that turned stats off.
Answer an empty repository's feed with a feedBryce Kwon-0/+4
Keep a repository's own settings in a cached scanBryce Kwon-12/+33
A scanned repository is read back from the cached list under the global settings, so a setting that only differed from them by being off, or by naming the default value, came back as the global one. branch-sort was written only for age, per-path module links not at all, and a filter a repository turned off left no line behind. Writing an empty value for a filter turned off makes the list depend on whether each global filter is set, so the scan key names that too.
Keep the placeholder out of a cached scanBryce Kwon-2/+9
The cached list wrote "[no description]" like any other description, so once read back it no longer counted as the placeholder and became the meta description of every repository without one. Repositories read back from the list are also marked as having had their description file read, since the scan already did, so the index does not open those files again on every request.
Leave the scan uncached with a negative cache-sizeBryce Kwon-1/+1
The page cache counts a cache-size of 0 or less as off, but scan-path cached its list for any value other than 0, so a negative one still wrote a list into cache-root.
Lead an error page's title with the errorBryce Kwon-3/+0
The config error page had a title of its own, in the reverse order, and now takes the same one as any other 404, since its message already says the repository failed to open.
Log the path of a repository that will not openBryce Kwon-0/+9
The 404 page names only the repository and nothing reached the log, so a mistyped repo.path left no trace of the path cgit had tried.
Read the description file without repo.descBryce Kwon-0/+1
Only a scanned repository fell back to its description file, so one listed in cgitrc without repo.desc showed "[no description]" however its file read. repo.desc may follow repo.path, so the file is read where a page shows the description, which also spares every other request the reads.
Report a word where cgitrc expects a numberBryce Kwon-67/+67
atoi reads "yes" or "true" as 0, so repo.hide=yes, or cgit.hide true in a scanned repository's git config, silently did nothing. The values keep that meaning, since honouring them now would hide repositories on upgrade, but each one is logged with its file and line.
Report a cgitrc or include that cannot be readBryce Kwon-2/+20
A missing or unreadable cgitrc left only "No repositories found" and an empty log, the commonest first mistake with no trace of its cause. A scanned repository's own cgitrc stays quiet, since most have none.
Keep a scan with a negative ttl for goodBryce Kwon-1/+2
"The cache" promises that a negative ttl never expires, but no age was ever below a negative cache-scan-ttl, so every request started a background rescan.
List scanned repositories in path orderBryce Kwon-0/+1
readdir hands entries back in whatever order the filesystem keeps them, so proj111 could come before proj105 and a section could start twice. section-sort is off by default to keep the order written in cgitrc, and a scan has none to keep.
Key the cached scan on every setting it usesBryce Kwon-5/+57
Two cgitrc files sharing a cache-root read one list, so strict-export and trust-scan-config set in one applied to the other, and a changed setting stayed stale until the list expired. The first request after an upgrade scans again, and the files under the old names are never read.
Reset the repository title before reusing itBryce Kwon-1/+3
Keep the repository title in one static bufferBryce Kwon-2/+6
Drop a query value check that cannot fireBryce Kwon-3/+0
Share one lock-file helper between the cachesBryce Kwon-35/+3
Keep the script name local to prepare_contextBryce Kwon-4/+1
Move cgit.c's own helpers out of shared.cBryce Kwon-6/+78
Spell the version banner cgitBryce Kwon-1/+1
Drop ui-blob's constant file_only argumentsBryce Kwon-1/+1
Keep the query string parser beside its one callerBryce Kwon-0/+17
Open and close each page through the layout callsBryce Kwon-8/+4
Sort with git's QSORTBryce Kwon-1/+1
QSORT skips a list of fewer than two entries, so an empty list's null base never reaches qsort, which is what cgit_qsort was written for.
Allocate formatted strings with git's xstrfmtBryce Kwon-4/+4
Lock the cached repolist with flockBryce Kwon-9/+4
The slot lock has to be an flock, since an exec filter drops a record lock when it closes the stdout a fill writes through. The scan only got by with fcntl because nothing reopens its file while it runs. One kind of lock lets the two share their code, and on Linux, where the kinds never see each other, an flock on the scan's file now holds a scan off like any other.
Open the lock files close-on-execBryce Kwon-1/+1
Each exec filter and snapshot compressor a fill runs inherited the slot's lock descriptor beside the stdout it writes into. An flock lasts until its last copy closes and nothing waits for a process a filter leaves behind, so a fill killed before its rename could leave the slot locked, and served stale or uncached, for as long as such a process lived. The scan holds its lock across no exec and opens the same way so that the two stay alike.
Use the parser's INT_MAX for every snapshot formatBryce Kwon-5/+1
The snapshots parser already answers all with INT_MAX, so cgit.c needed no value of its own for the same mask.
Hand back the fallback branch rather than a copyBryce Kwon-13/+4
Drop dead checks and a repeated filter cleanupBryce Kwon-12/+7
build_snapshot_setting always returns a buffer, both commit-sort values are tested on their own, authenticate_post ends the process, and the filters are cleaned up by the atexit handler once cmd_main returns.
Cap the search with xstrndup aloneBryce Kwon-4/+1
Rename prepare_repo_env to open_repoBryce Kwon-2/+2
It opens the repository and loads its notes, while cgit_prepare_repo_env exports the CGIT_REPO_ variables, and the two names were one prefix apart.
Explain the notes setup in one commentBryce Kwon-4/+3
Let scan_tree choose the project list itselfBryce Kwon-12/+3
Three callers wrote out the same choice, and the header already says a scan visits only the listed paths when a project list is set.
Drop the command line switches the query coversBryce Kwon-11/+0
--repo= only stored the name, so it never selected a repository, and --query= already reaches what the other four set, with the offset clamped the way a request's is.
Drop the defaults the memset already setsBryce Kwon-17/+0
prepare_context zeroes the whole context first, and the repository list is a global, so neither needs its zeros written out again.
Mark the static pages in the command tableBryce Kwon-28/+2
The table already records what each page needs, and a second list of page names in cgit.c had to be kept in step with it by hand.
Set the virtual root from SCRIPT_NAME up frontBryce Kwon-6/+5
The script name always holds a value, so the fallback after parsing fired whenever cgitrc left virtual-root unset. The root is now set with the other defaults, for cgitrc to replace. A die while cgitrc is read is the one change, and its page now links the root with the trailing slash every other page has.
Offer the versions as an optionBryce Kwon-0/+2
enable-version-info brings back the cgit and git versions that 872bd7c took off the footer and the generator tag, for a site that wants them, and the version f7d2b83 put on the signature of patches now follows it too. It stays off by default for the reason 872bd7c gave.
Name the page first in every titleBryce Kwon-1/+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.
Sign patches with the cgit versionBryce Kwon-0/+2
git format-patch ends each patch with the version of git that wrote it, and the bare "cgit" that 872bd7c left in its place said less. The version is written as git writes its own, without the v of the tag, so a release build signs with "cgit 2.9.0". The footer and the generator tag still leave versions out.
Isolate git from HOME before git's own setupBryce Kwon-3/+5
Git reads the global config for its trace settings before cmd_main is reached, so the isolation there came too late and every request probed $HOME/.gitconfig. The home-access test had passed only because access is not a syscall of its own everywhere, so it now traces every call that takes a path.
Sort an empty list without handing qsort a nullBryce Kwon-1/+1
Every list sorted here is null until its first entry, and C leaves a null base undefined even with nothing to sort. glibc declares it nonnull, and a UBSan build aborted the stats page of a repository with no commits in the window.
Pass over a notes ref that names no treeBryce Kwon-3/+14
A pusher can point refs/notes/commits or a signature notes ref at any object, and git dies loading one that is no tree, which ended every page of the repository, the dumb transport included.
Keep string literals behind const pointersBryce Kwon-1/+1
Git's DEVELOPER=1 build turns on -Wwrite-strings as an error, and the literals stored through plain char pointers failed cgit's own objects there. The exec filter's argv takes the cast execvp needs once, the way git's run-command does.
Remove what the version removal left behindBryce Kwon-2/+0
Cache every branch page under cache-dynamic-ttlBryce Kwon-7/+2
The dynamic ttl only applied when the url named a branch with h=, so the log, tree and refs of the default branch, which never carry one, fell back to cache-summary-ttl. The manual already gives each ttl the scope the code now uses.
Gate a readme ending in a colon like a disk pathBryce Kwon-4/+2
trust-scan-config passed any readme holding a colon as a tracked file, while the parser takes one only when a path follows the colon, so a scanned repository could still name a file on disk outside itself.
End a request quietly when the client has goneBryce Kwon-1/+3
A write that failed with EPIPE on an uncached page died into an error page, which died again at exit when the page could not be sent either, and git logged a recursion warning on every dropped connection. A filter that exits early fails a write the same way, so the quiet exit is kept for writes that reach the client itself.
Stop caching clone files and oversized responsesBryce Kwon-1/+19
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.