diff options
author | Lars Hjemli | 2007-06-17 14:53:02 +0200 |
---|---|---|
committer | Lars Hjemli | 2007-06-17 14:53:02 +0200 |
commit | 42a7eb9c73457319a3fd5441ff26046fc9b31dad (patch) | |
tree | 4771b955e031005e7c222ef0cbabb719f7cd003a /ui-shared.c | |
parent | 48c487d72daef7e71683a85f775db8d36ab20341 (diff) | |
download | cgit-42a7eb9c73457319a3fd5441ff26046fc9b31dad.tar.gz cgit-42a7eb9c73457319a3fd5441ff26046fc9b31dad.tar.bz2 cgit-42a7eb9c73457319a3fd5441ff26046fc9b31dad.zip |
Add cgit_commit_link() + support for id=sha1 to commit view
This adds a function to generate links to the commit page and extends said
page to use id from querystring as primary revision specified (fallback to
h).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index 64ee79c..71c899a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -136,8 +136,8 @@ static char *repolink(char *title, char *class, char *page, char *head, | |||
136 | return fmt("%s", delim); | 136 | return fmt("%s", delim); |
137 | } | 137 | } |
138 | 138 | ||
139 | static char *reporevlink(char *page, char *name, char *title, char *class, | 139 | static void reporevlink(char *page, char *name, char *title, char *class, |
140 | char *head, char *rev, char *path) | 140 | char *head, char *rev, char *path) |
141 | { | 141 | { |
142 | char *delim; | 142 | char *delim; |
143 | 143 | ||
@@ -164,6 +164,18 @@ void cgit_log_link(char *name, char *title, char *class, char *head, | |||
164 | reporevlink("log", name, title, class, head, rev, path); | 164 | reporevlink("log", name, title, class, head, rev, path); |
165 | } | 165 | } |
166 | 166 | ||
167 | void cgit_commit_link(char *name, char *title, char *class, char *head, | ||
168 | char *rev) | ||
169 | { | ||
170 | if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) { | ||
171 | name[cgit_max_msg_len] = '\0'; | ||
172 | name[cgit_max_msg_len - 1] = '.'; | ||
173 | name[cgit_max_msg_len - 2] = '.'; | ||
174 | name[cgit_max_msg_len - 3] = '.'; | ||
175 | } | ||
176 | reporevlink("commit", name, title, class, head, rev, NULL); | ||
177 | } | ||
178 | |||
167 | void cgit_print_date(time_t secs, char *format) | 179 | void cgit_print_date(time_t secs, char *format) |
168 | { | 180 | { |
169 | char buf[64]; | 181 | char buf[64]; |