From e397ff7024293223f48f235fcf072fc526cae7af Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Thu, 25 Oct 2007 09:30:06 +0200 Subject: Add functions and types for ref lists This adds two structs, refinfo and reflist, and functions for building a list of refs. Signed-off-by: Lars Hjemli --- cgit.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index e96311f..75e919b 100644 --- a/cgit.h +++ b/cgit.h @@ -98,6 +98,21 @@ struct taginfo { char *msg; }; +struct refinfo { + const char *refname; + struct object *object; + union { + struct taginfo *tag; + struct commitinfo *commit; + }; +}; + +struct reflist { + struct refinfo **refs; + int alloc; + int count; +}; + extern const char *cgit_version; extern struct repolist cgit_repolist; @@ -162,6 +177,10 @@ extern int chk_non_negative(int result, char *msg); extern int hextoint(char c); extern char *trim_end(const char *str, char c); +extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); +extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, + int flags, void *cb_data); + extern void *cgit_free_commitinfo(struct commitinfo *info); extern int cgit_diff_files(const unsigned char *old_sha1, -- cgit v1.2.3 From fe211c7eef6c7d3e39486d6a7484d3b4debff88f Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Thu, 25 Oct 2007 10:40:16 +0200 Subject: Add support for config param summary-tags This parameter can be used to specify max number of tags to show on the summary page. If not specified, all tags are printed. Signed-off-by: Lars Hjemli --- cgit.h | 1 + 1 file changed, 1 insertion(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index 75e919b..53e1336 100644 --- a/cgit.h +++ b/cgit.h @@ -143,6 +143,7 @@ extern int cgit_cache_dynamic_ttl; extern int cgit_cache_static_ttl; extern int cgit_cache_max_create_time; extern int cgit_summary_log; +extern int cgit_summary_tags; extern int cgit_max_msg_len; extern int cgit_max_repodesc_len; -- cgit v1.2.3 From 763a6a09deec7290365a0072d25630daa7b417e2 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 27 Oct 2007 10:13:42 +0200 Subject: Add support for config param summary-branches This parameter can be used to specify max number of branches to show on the summary page (if not all branches will be displayed, the "most idle" branches are the ones to be pruned). The default value for this parameter is 0, which disables the pruning. Signed-off-by: Lars Hjemli --- cgit.h | 1 + 1 file changed, 1 insertion(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index 53e1336..bb0e64c 100644 --- a/cgit.h +++ b/cgit.h @@ -144,6 +144,7 @@ extern int cgit_cache_static_ttl; extern int cgit_cache_max_create_time; extern int cgit_summary_log; extern int cgit_summary_tags; +extern int cgit_summary_branches; extern int cgit_max_msg_len; extern int cgit_max_repodesc_len; -- cgit v1.2.3 From 8efb05f98ad389d1b7f5aac17838401908622dad Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 27 Oct 2007 10:25:40 +0200 Subject: Make cgit_print_branches()/cgit_print_tags() external Signed-off-by: Lars Hjemli --- cgit.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index bb0e64c..a1fe527 100644 --- a/cgit.h +++ b/cgit.h @@ -251,6 +251,8 @@ extern void cgit_print_pageheader(char *title, int show_search); extern void cgit_print_snapshot_start(const char *mimetype, const char *filename, struct cacheitem *item); +extern void cgit_print_branches(int maxcount); +extern void cgit_print_tags(int maxcount); extern void cgit_print_repolist(struct cacheitem *item); extern void cgit_print_summary(); -- cgit v1.2.3 From 7937d06090dd5e19145ec6fa8befc5770954b30c Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 27 Oct 2007 10:36:53 +0200 Subject: Add support for refs view This enables the new urls $repo/refs, $repo/refs/heads and $repo/refs/tags, which can be used to print _all_ branches and/or tags. Signed-off-by: Lars Hjemli --- cgit.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index a1fe527..d9a15f4 100644 --- a/cgit.h +++ b/cgit.h @@ -28,6 +28,7 @@ #define CMD_BLOB 5 #define CMD_SNAPSHOT 6 #define CMD_TAG 7 +#define CMD_REFS 8 /* * Dateformats used on misc. pages @@ -260,6 +261,7 @@ extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char * extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); extern void cgit_print_tree(const char *rev, char *path); extern void cgit_print_commit(char *hex); +extern void cgit_print_refs(); extern void cgit_print_tag(char *revname); extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix); extern void cgit_print_snapshot(struct cacheitem *item, const char *head, -- cgit v1.2.3 From ac1f493b6bbc589327e9ba3303f112fcd323c6b6 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 27 Oct 2007 10:47:44 +0200 Subject: Add links to the new refs page from summary page If either branches or tags are filtered on the summary page, add a link to refs/heads and/or refs/tags right below the last branch/tag. Signed-off-by: Lars Hjemli --- cgit.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index d9a15f4..f8f0316 100644 --- a/cgit.h +++ b/cgit.h @@ -236,6 +236,8 @@ extern void cgit_log_link(char *name, char *title, char *class, char *head, char *rev, char *path, int ofs); extern void cgit_commit_link(char *name, char *title, char *class, char *head, char *rev); +extern void cgit_refs_link(char *name, char *title, char *class, char *head, + char *rev, char *path); extern void cgit_snapshot_link(char *name, char *title, char *class, char *head, char *rev, char *archivename); extern void cgit_diff_link(char *name, char *title, char *class, char *head, -- cgit v1.2.3