From 920ac1b0ef0971d02f277d07c860e1a36c644a5b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 18:25:28 -1000 Subject: Give an empty repository's clone table its hooks It was a bare table.list with no name, section or label, the one listing that broke what the README promises a theme. --- README.txt | 9 +++++---- source/ui-empty.c | 6 +++--- tests/t0005-markup.sh | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.txt b/README.txt index 37141d3..2bc9f39 100644 --- a/README.txt +++ b/README.txt @@ -80,10 +80,11 @@ script added through the css and js options has stable hooks to work with. carries an aria-label, and the active tab and the current pager link carry aria-current. * Every listing is a table.list with a second class naming it, repolist, - summary, refs, log or tree. Each section of a listing is a tbody named - repos, branches, tags, log, clone or tree, and each row carries its kind, - repo, branch, tag, commit, dir, blob, link or mod. A file row's link also - carries ext- followed by the file extension. + summary, refs, log, tree or clone, the last holding the clone urls of an + empty repository. Each section of a listing is a tbody named repos, + branches, tags, log, clone or tree, and each row carries its kind, repo, + branch, tag, commit, dir, blob, link or mod. A file row's link also carries + ext- followed by the file extension. * The commit and tag pages use table.commit-info, the trailer table is table.commit-trailers, the diffstat is table.diffstat and each file of a diff is div.file, or tbody.file in the side by side view, with the path in diff --git a/source/ui-empty.c b/source/ui-empty.c index 30887c5..deefc21 100644 --- a/source/ui-empty.c +++ b/source/ui-empty.c @@ -29,8 +29,8 @@ void cgit_print_empty_repo(void) if (!ctx.repo->clone_url && !ctx.cfg.clone_prefix) return; - html("\n"); - html("\n"); + html("
Clone
\n\n"); + html("\n"); cgit_add_clone_urls(print_clone_url); - html("
Clone
\n"); + html("\n\n"); } diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh index bbf78b1..e3cb08d 100755 --- a/tests/t0005-markup.sh +++ b/tests/t0005-markup.sh @@ -97,8 +97,9 @@ test_expect_success 'the stylesheet and the script name only the current hooks' ' # The rest of the hooks need a tag, a symlink, a submodule, a trailer, clone -# urls and a second page of repositories, so they get a commit and a config -# of their own after the checks above have read the first ones. +# urls, an empty repository and a second page of repositories, so they get a +# commit and a config of their own after the checks above have read the first +# ones. test_expect_success 'set up the remaining kinds of entry' ' ( cd repos/hooks && @@ -107,6 +108,7 @@ test_expect_success 'set up the remaining kinds of entry' ' git update-index --add --cacheinfo "160000,$(git rev-parse HEAD),sub" && git commit -m "more kinds of entry" -m "Fixes: $(git rev-parse --short HEAD)" ) && + git init -q --bare repos/empty.git && { echo "virtual-root=/" && echo "cache-size=0" && @@ -116,7 +118,9 @@ test_expect_success 'set up the remaining kinds of entry' ' echo "repo.url=hooks" && echo "repo.path=$PWD/repos/hooks/.git" && echo "repo.url=again" && - echo "repo.path=$PWD/repos/hooks/.git" + echo "repo.path=$PWD/repos/hooks/.git" && + echo "repo.url=empty" && + echo "repo.path=$PWD/repos/empty.git" } >morerc ' @@ -160,6 +164,12 @@ test_expect_success 'a date shown in full is a plain time element' ' ! grep "data-ut=" tmp ' +test_expect_success 'an empty repository lists its clone urls as a clone table' ' + more "empty/" >tmp && + grep "" tmp && + grep "" tmp +' + test_expect_success 'embedded mode marks the root' ' { echo "embedded=1" && -- cgit