summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--cgit.c3
-rw-r--r--cgit.h2
-rw-r--r--shared.c2
-rw-r--r--ui-refs.c30
5 files changed, 37 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8e3da72..36b5ff6 100644
--- a/Makefile
+++ b/Makefile
@@ -13,13 +13,13 @@ GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
13-include cgit.conf 13-include cgit.conf
14 14
15 15
16EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto 16EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
17OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \ 17OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \
18 ui-summary.o ui-log.o ui-tree.o ui-commit.o ui-diff.o \ 18 ui-summary.o ui-log.o ui-tree.o ui-commit.o ui-diff.o \
19 ui-snapshot.o ui-blob.o ui-tag.o 19 ui-snapshot.o ui-blob.o ui-tag.o ui-refs.o
20 20
21 21
22.PHONY: all git install clean distclean force-version get-git 22.PHONY: all git install clean distclean force-version get-git
23 23
24all: cgit git 24all: cgit git
25 25
diff --git a/cgit.c b/cgit.c
index 1b85b15..cc18ed4 100644
--- a/cgit.c
+++ b/cgit.c
@@ -100,12 +100,15 @@ static void cgit_print_repo_page(struct cacheitem *item)
100 case CMD_TREE: 100 case CMD_TREE:
101 cgit_print_tree(cgit_query_sha1, cgit_query_path); 101 cgit_print_tree(cgit_query_sha1, cgit_query_path);
102 break; 102 break;
103 case CMD_COMMIT: 103 case CMD_COMMIT:
104 cgit_print_commit(cgit_query_sha1); 104 cgit_print_commit(cgit_query_sha1);
105 break; 105 break;
106 case CMD_REFS:
107 cgit_print_refs();
108 break;
106 case CMD_TAG: 109 case CMD_TAG:
107 cgit_print_tag(cgit_query_sha1); 110 cgit_print_tag(cgit_query_sha1);
108 break; 111 break;
109 case CMD_DIFF: 112 case CMD_DIFF:
110 cgit_print_diff(cgit_query_sha1, cgit_query_sha2, cgit_query_path); 113 cgit_print_diff(cgit_query_sha1, cgit_query_sha2, cgit_query_path);
111 break; 114 break;
diff --git a/cgit.h b/cgit.h
index a1fe527..d9a15f4 100644
--- a/cgit.h
+++ b/cgit.h
@@ -25,12 +25,13 @@
25#define CMD_COMMIT 2 25#define CMD_COMMIT 2
26#define CMD_DIFF 3 26#define CMD_DIFF 3
27#define CMD_TREE 4 27#define CMD_TREE 4
28#define CMD_BLOB 5 28#define CMD_BLOB 5
29#define CMD_SNAPSHOT 6 29#define CMD_SNAPSHOT 6
30#define CMD_TAG 7 30#define CMD_TAG 7
31#define CMD_REFS 8
31 32
32/* 33/*
33 * Dateformats used on misc. pages 34 * Dateformats used on misc. pages
34 */ 35 */
35#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" 36#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S"
36#define FMT_SHORTDATE "%Y-%m-%d" 37#define FMT_SHORTDATE "%Y-%m-%d"
@@ -257,12 +258,13 @@ extern void cgit_print_tags(int maxcount);
257extern void cgit_print_repolist(struct cacheitem *item); 258extern void cgit_print_repolist(struct cacheitem *item);
258extern void cgit_print_summary(); 259extern void cgit_print_summary();
259extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); 260extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager);
260extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 261extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
261extern void cgit_print_tree(const char *rev, char *path); 262extern void cgit_print_tree(const char *rev, char *path);
262extern void cgit_print_commit(char *hex); 263extern void cgit_print_commit(char *hex);
264extern void cgit_print_refs();
263extern void cgit_print_tag(char *revname); 265extern void cgit_print_tag(char *revname);
264extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix); 266extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix);
265extern void cgit_print_snapshot(struct cacheitem *item, const char *head, 267extern void cgit_print_snapshot(struct cacheitem *item, const char *head,
266 const char *hex, const char *prefix, 268 const char *hex, const char *prefix,
267 const char *filename, int snapshot); 269 const char *filename, int snapshot);
268extern void cgit_print_snapshot_links(const char *repo, const char *head, 270extern void cgit_print_snapshot_links(const char *repo, const char *head,
diff --git a/shared.c b/shared.c
index ff600db..7eb2b0e 100644
--- a/shared.c
+++ b/shared.c
@@ -63,13 +63,13 @@ int cgit_query_ofs = 0;
63int htmlfd = 0; 63int htmlfd = 0;
64 64
65 65
66int cgit_get_cmd_index(const char *cmd) 66int cgit_get_cmd_index(const char *cmd)
67{ 67{
68 static char *cmds[] = {"log", "commit", "diff", "tree", "blob", 68 static char *cmds[] = {"log", "commit", "diff", "tree", "blob",
69 "snapshot", "tag", NULL}; 69 "snapshot", "tag", "refs", NULL};
70 int i; 70 int i;
71 71
72 for(i = 0; cmds[i]; i++) 72 for(i = 0; cmds[i]; i++)
73 if (!strcmp(cmd, cmds[i])) 73 if (!strcmp(cmd, cmds[i]))
74 return i + 1; 74 return i + 1;
75 return 0; 75 return 0;
diff --git a/ui-refs.c b/ui-refs.c
new file mode 100644
index 0000000..295f5ba
--- a/dev/null
+++ b/ui-refs.c
@@ -0,0 +1,30 @@
1/* ui-refs.c: browse symbolic refs
2 *
3 * Copyright (C) 2006 Lars Hjemli
4 *
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
7 */
8
9#include "cgit.h"
10
11
12
13
14void cgit_print_refs()
15{
16
17 html("<table class='list nowrap'>");
18
19 if (cgit_query_path && !strncmp(cgit_query_path, "heads", 5))
20 cgit_print_branches(0);
21 else if (cgit_query_path && !strncmp(cgit_query_path, "tags", 4))
22 cgit_print_tags(0);
23 else {
24 cgit_print_branches(0);
25 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
26 cgit_print_tags(0);
27 }
28
29 html("</table>");
30}