AgeCommit message (Collapse)AuthorLines
Percent-encode a clone url in its hrefBryce Kwon-1/+35
An href carried git://example.org/dépôt.git as it was, and the space of "with space" too, neither of which a url may hold. html_url_path would also encode the plus of git+ssh, which breaks the scheme, and the percent of an escape the url was written with, so a whole url gets a helper that encodes only the bytes RFC 3986 allows nowhere.
Keep a space in a repository url in one clone urlBryce Kwon-0/+16
The shared repository "with space" listed git://example.org/with and space.git as two clone urls, and the head linked the first alone. The manual calls clone-url a list of templates, so the list is now split before each template is expanded. A clone-prefix was right already, as the url is joined to it after the split.
Test the author and age of a lightweight tag rowBryce Kwon-0/+10
Test clone urls made from clone-prefixBryce Kwon-0/+9
Test remote branches shown and hiddenBryce Kwon-0/+27
enable-remote-branches had no test anywhere, so the branch list, the switcher or the log label could each stop honouring it unnoticed.
Check the tag cells hold what their heading namesBryce Kwon-1/+4
Only the heading was checked, so a heading and cells that disagreed about snapshots passed.
Hold the summary tests to a working pageBryce Kwon-24/+44
The summary requests passed on any answer short of a crash, and the checks for no tags and no commit 45 read a page another test wrote. The log checks also matched the branch row, which shows the newest subject too. Two checks under a title about the clone rows matched the vcs-git links in the head instead, and the dots in the [...] count matched any three characters.
Head the tag table's column for what it holdsBryce Kwon-0/+13
Add the shared config writers and cgit_rcBryce Kwon-13/+7
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.
Show the column fixture's commits like the othersBryce Kwon-1/+1
Check a summary's branch, tags and clone url onceBryce Kwon-5/+0
bar's copies read the same page code as foo's, and the clone url row test that follows matches bar's url in full.
Tighten the checks that match stray textBryce Kwon-2/+2
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.
Open the empty page's clone table on its first urlBryce Kwon-0/+29
The page guessed from the two settings cgit_add_clone_urls reads, so a clone-url that expanded to nothing, or an empty one turning the global off, still drew a Clone heading over no rows. The summary already waits for a first url, and both now draw the heading the same way.
Give every summary section the same columnsBryce Kwon-0/+77
The ref rows always spanned five columns and the log three to five, so with the default config the log and clone rows stopped 160px short of the table's edge, and with any config the log rows did on a phone, where they alone lost their counts. A column no cell began in also made the summary and refs pages invalid HTML.
Trim the comments and dead code across the treeBryce Kwon-6/+4
Point clone rows at a url a browser can followBryce Kwon-0/+21
Add a meta description to the page headBryce Kwon-0/+3
Tidy the test comments and shell portabilityBryce Kwon-0/+7
Rebuild the page chrome as semantic HTMLBryce Kwon-2/+2
The masthead, tab bar, breadcrumb, content region and footer were HTML tables, which cannot reflow and forced the page to scroll sideways on small screens. Class and id names are kept so custom themes keep matching.
tests: use Git's test frameworkJohn Keeping-18/+17
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-11/+11
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>
cgit.c: add 'clone-url' setting with support for macro expansionLars Hjemli-0/+6
The current 'clone-prefix' setting has some known issues: * All repos get the same 'clone-prefix' value since the setting is not adopted during repo registration (in cgitrc, or during scan-path traversal), but only when the setting is used. * The generated clone-urls for a repo is a combination of 'clone-prefix', a slash and the repo url. This doesn't work well with e.g. ssh-style urls like 'git@example.org:repo.git', since the inserted slash will make the repo relative to the filesystem root. * If 'remove-suffix' is enabled, the generated clone-urls will not work for cloning (except for http-urls to cgit itself) since they miss the '.git' suffix. The new 'clone-url' setting is designed to avoid the mentioned issues: * Each repo adopts the default 'clone-url' when the repo is defined. This allows different groups of repos to adopt different values. * The clone-urls for a repo is generated by expanding environment variables in a string template without inserting arbitrary characters, hence any kind of clone-url can be generated. * Macro expansion also eases the 'remove-suffix' pain since it's now possible to define e.g. 'clone-url=git://foo.org/$CGIT_REPO_URL.git' for a set of repos. A furter improvement would be to define e.g. $CGIT_REPO_SUFFIX to '.git' for all repos which had their url prettified, or to store the original $CGIT_REPO_URL in e.g. $CGIT_REPO_REAL_URL before suffix removal. Reviewed-by: Ferry Huberts <mailings@hupie.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Brown paper bag: don't use `grep -v`Lars Hjemli-3/+3
For some inexplicable reason I'd gotten the semantics of `grep -v` totally backwards, thinking it somehow would make the exitcode from grep indicate the non-match of the specified pattern. This fixes the broken tests and gives me a valuable lession about shell programming at the same time. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Create initial testsuiteLars Hjemli-0/+20
This creates a simple testsuite, heavily inspired by the testsuite in git. Signed-off-by: Lars Hjemli <hjemli@gmail.com>