diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Give empty repositories their own page
Diffstat (limited to 'source/ui-empty.c')
-rw-r--r--source/ui-empty.c41
1 file changed, 41 insertions, 0 deletions
diff --git a/source/ui-empty.c b/source/ui-empty.c
new file mode 100644
index 0000000..cb91fbc
--- /dev/null
+++ b/source/ui-empty.c
@@ -0,0 +1,41 @@
+/*
+ * ui-empty.c: page shown for a repository that holds no commits
+ *
+ * Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com>
+ *
+ * Licensed under GNU General Public License v2
+ * (see LICENSE.txt for full license text)
+ */
+
+#include "cgit.h"
+#include "ui-empty.h"
+#include "html.h"
+#include "ui-shared.h"
+
+static void print_clone_url(const char *url)
+{
+ html("<tr><td><a rel='vcs-git' href='");
+ html_url_path(url);
+ html("' title='");
+ html_attr(ctx.repo->name);
+ html(" Git repository'>");
+ html_txt(url);
+ html("</a></td></tr>\n");
+}
+
+/*
+ * 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");
+
+ if (!ctx.repo->clone_url && !ctx.cfg.clone_prefix)
+ return;
+
+ html("<table summary='clone urls' class='list nowrap'>");
+ html("<tr class='nohover'><th class='left'>Clone</th></tr>\n");
+ cgit_add_clone_urls(print_clone_url);
+ html("</table>\n");
+}