/* * The page a repository with no commits falls back to, an error line and then * the clone urls someone needs in order to push the first commit. cgit.c * prints this in place of whatever page was asked for as soon as it finds * there is no branch to resolve, so none of the ref driven pages ever run * against an empty repository. */ #include "cgit.h" #include "html.h" #include "ui-empty.h" #include "ui-shared.h" static int clone_urls_printed; static void print_clone_url(const char *url) { // cgit_add_clone_urls may call back no times at all, so the table // waits for a first url rather than being opened ahead of the walk. if (clone_urls_printed++ == 0) { html("\n\n"); html("\n"); } cgit_print_clone_row(url, 0); } /* * The caller has already prepared the repo environment, which the clone urls * need for macro expansion. */ void cgit_print_empty_repo(void) { cgit_print_error("Repository seems to be empty"); clone_urls_printed = 0; cgit_add_clone_urls(print_clone_url); if (clone_urls_printed) html("\n
Clone
\n"); }