AgeCommit message (Collapse)AuthorLines
Move the tree grouping test to the tree testsBryce Kwon-0/+18
Grouping folders first is tree page behaviour rather than a security fix, so it joins the tree tests on a repository of its own.
Read the stylesheet rules by selectorBryce Kwon-7/+51
Both tests cut one block out of cgit.css by its opening line, so rewriting that selector list broke them while a later rule overriding the declaration passed. The helper gathers a property's declarations from every rule naming the selector, so the last one is the one a browser would apply. A rule under some other selector can still win, which only a browser shows.
Test the blame tooltip with and without addressesBryce Kwon-0/+13
Test a link target that climbs above the rootBryce Kwon-2/+6
Only an absolute target was tested, so ignoring a failed normalisation passed, and the mutation run left that change alive.
Follow the blame page's crumb and previous linksBryce Kwon-2/+9
Both fixes were for links that led to a 404, and the tests read the href without asking for the page it names.
Test what blame says for paths it cannot blameBryce Kwon-0/+12
Test that blame is refused while disabledBryce Kwon-0/+6
Test the blame link in the file view's headerBryce Kwon-0/+8
Prove the rows the blame link check looks pastBryce Kwon-6/+10
The checks that blob.bin, big.bin and large.txt get no blame link never showed those rows were in the listing, so a listing that dropped them passed.
Hold the tree tests to a working pageBryce Kwon-36/+50
The tree requests passed on any answer short of a crash. Several tests read a page or a row an earlier test wrote, so run alone they passed or failed by accident, and two leant on a repository from the test before without saying so. The file-50 check also matched its href, and the blame check skipped the form feed and NEL its title covers.
Pin the listing's blame link for a late NULBryce Kwon-0/+23
The listing judges binary by the first 8000 bytes, as git does, while the blame page and the file view look for a NUL anywhere, since one past that window would end a Lua filter's output early. The listing keeps the cheap sniff, because the whole-blob check would inflate every blob it names, so a file whose NUL lies past the window gets a blame link that ends on "Blob is binary". The test pins that trade, so a change to either side has to face it.
Let a keyboard scroll the hex dumpBryce Kwon-1/+10
Chrome and Firefox already let an overflowing box take focus, with their own ring, but WebKit does not. The table takes focus on a mouse click as well, where focus-visible keeps the ring off.
Read the file and diff tables as layoutBryce Kwon-0/+6
The file view's table only sets the line numbers beside the code, and the unified diff's is a single cell holding every file.
Answer a submodule path with the submoduleBryce Kwon-0/+9
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.
Offer blame only where it worksBryce Kwon-0/+29
The blame page answers 404 for a symlink, since git blames a regular file alone, and it refuses a binary file and one past max-blob-size, yet a tree listing offered blame for all of them, and so did a symlink's own page. Each row already knows its size, and git calls a file binary by its first 8000 bytes alone, which a stream reads without inflating the rest. With blame on, a listing of 2,000 delta-packed files went from about 11 to 15 ms.
Dump only the first 64 KB of a binary fileBryce Kwon-1/+18
Blame the previous revision under its own nameBryce Kwon-0/+21
Lead a blame page's folder crumbs to the treeBryce Kwon-0/+16
Add the shared config writers and cgit_rcBryce Kwon-46/+14
The helpers are named by kind. cgitrc_repo and cgitrc_copy write the config file named first, and cgit_url, cgit_query and cgit_rc run cgit, each named after what it is handed first. A repository copies its defaults from the globals read before its repo.url, so cgitrc_repo places every setting itself, and a global can no longer land where it silently stops applying. The t00xx and t01xx files move to them here.
Drop test lines that repeat what came beforeBryce Kwon-1/+0
The download row was already matched on the same tag page, no fold can sit between the message and the signature the check requires, and the submodule row is the one the test before extracted.
Tighten the checks that match stray textBryce Kwon-1/+1
Every page holds foo in its footer element, the foo+bar row holds bar, the branch switcher holds master, and commit 1 and file-1 also match commits 10 to 19 and file-10 to file-19. A search page repeats its term in the search box. So these checks passed on pages that lacked what they look for, and each now matches the link itself.
Tidy up after a directory chain however it endsBryce Kwon-0/+27
A row whose first entry is itself a directory leaked that entry's name. A level git could not read as a tree returned early instead, which also left the row's log, stats and plain links on the deeper path.
Name the graph and links header cellsBryce Kwon-0/+3
Both were empty, so a screen reader moving through the table announced those columns with no name. An aria-label names them without adding text to the page.
Show characters a browser breaks at as escapesBryce Kwon-0/+51
The HTML parser turns a carriage return with no line feed after it into a line feed, and WebKit starts a new line at U+2028 and U+2029, while git and the line numbers count line feeds alone, so each one set every later line of the tree and blame pages a line below its number. CSS Text makes vertical tab, form feed and next line forced breaks as well, though no engine honours that yet. The escapes follow gitweb, which shows control characters the same way.
Keep the code in step with its line numbersBryce Kwon-0/+9
The stylesheet overhaul in 722524b gave the pre of the tree and blame pages the site's monospace font but left the code element inside it on the browser's own, Courier in Safari and DejaVu Sans Mono on a typical Linux desktop. A line box holds both fonts on one baseline, so where their ascent and descent differ each code line comes out a little taller than its number. By the end of a 2,000 line file the code sat 45 lines low with Courier and 109 with DejaVu Sans Mono.
Test the features the suite never reachedBryce Kwon-0/+19
Index sorting, the commit graph, the stats periods past a week, the hex dump of a binary file and a Lua filter's html_url_arg and html_include ran in no test.
End a long directory chain on its last linkBryce Kwon-0/+27
Past fifteen single directories the row stopped after writing the next separator, which left it ending in a dangling " / ".
Show an absolute link target as textBryce Kwon-0/+26
A symlink to /etc/passwd was resolved against the tree and linked to etc/passwd inside it, a different file or none at all.
Clean up the whole treeBryce Kwon-2/+1
Trim the comments and dead code across the treeBryce Kwon-6/+4
Fix the submodule rows in the tree listingBryce Kwon-0/+49
A submodule row linked to a path with its trailing slash stripped, was labelled by its path rather than its entry name, shared the name's element with its hash, claimed a size of zero and offered a blame button that cannot work on a gitlink.
Fix ampersand handling in generated urlsBryce Kwon-4/+5
Tidy the test comments and shell portabilityBryce Kwon-0/+6
Reduce line number bloat, fix hover effectPeter Wu-2/+2
Currently line numbers look like (for blob view and sdiff respectively): <a class='no' id='n68' name='n68' href='#n68'>68</a> <td class='lineno'><a class='no' href='...#n1' id='n1' name='n1'>1</a></td> name=".." is unnecessary if the id attribute is set (this even applies to IE6), so drop it. (aside, in HTML5, the name attribute is gone.) The line number links can be selected through their parent classes, no need for another class "no", so drop it too. For a file with 2000 lines, this yields a saving of 40% (29% gzipped). While at it, fix the hover effect of line numbers: now the line number get a black background as was intended. Signed-off-by: Peter Wu <lekensteyn@gmail.com> Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
tests: use Git's test frameworkJohn Keeping-17/+16
This allows tests to run in parallel as well as letting us use "prove" or another TAP harness to run the tests. Git's test framework requires Git to be fully built before letting any tests run, so add a new target to the top-level Makefile which builds all of Git instead of just libgit.a and make the "test" target depend on that. Signed-off-by: John Keeping <john@keeping.me.uk>
tests: "grep -e" is not portable to all platformsJohn Keeping-6/+6
The "-e" option to grep is not needed unless specifying more than one pattern, which we don't do. Remove it to avoid restricting the tests on platforms that do not have a grep that recognises "-e". Signed-off-by: John Keeping <john@keeping.me.uk>
changed objects are outputted, allowing for selections of code onlyOnne Gorter-2/+2
ui-tree.c: do not add blank line when displaying blobsLars Hjemli-1/+1
Also, fix a related bug in the test-suite. Noticed-by: Jim Meyering <jim@meyering.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
ui-shared.c: use html_url_arg()Lars Hjemli-0/+12
The link-generating functions are updated to use the new html_url_arg function, thereby fixing links to strange repos, branches and files. Also, the test-suite is updated to verify some cases of strange urls. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Fix html error detected by test-suiteLars Hjemli-2/+8
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Create initial testsuiteLars Hjemli-0/+15
This creates a simple testsuite, heavily inspired by the testsuite in git. Signed-off-by: Lars Hjemli <hjemli@gmail.com>