mirror of
https://git.zx2c4.com/cgit
synced 2025-07-12 19:24:30 +02:00
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>
This commit is contained in:
parent
48c487d72d
commit
42a7eb9c73
7 changed files with 31 additions and 18 deletions
16
ui-shared.c
16
ui-shared.c
|
@ -136,8 +136,8 @@ static char *repolink(char *title, char *class, char *page, char *head,
|
|||
return fmt("%s", delim);
|
||||
}
|
||||
|
||||
static char *reporevlink(char *page, char *name, char *title, char *class,
|
||||
char *head, char *rev, char *path)
|
||||
static void reporevlink(char *page, char *name, char *title, char *class,
|
||||
char *head, char *rev, char *path)
|
||||
{
|
||||
char *delim;
|
||||
|
||||
|
@ -164,6 +164,18 @@ void cgit_log_link(char *name, char *title, char *class, char *head,
|
|||
reporevlink("log", name, title, class, head, rev, path);
|
||||
}
|
||||
|
||||
void cgit_commit_link(char *name, char *title, char *class, char *head,
|
||||
char *rev)
|
||||
{
|
||||
if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) {
|
||||
name[cgit_max_msg_len] = '\0';
|
||||
name[cgit_max_msg_len - 1] = '.';
|
||||
name[cgit_max_msg_len - 2] = '.';
|
||||
name[cgit_max_msg_len - 3] = '.';
|
||||
}
|
||||
reporevlink("commit", name, title, class, head, rev, NULL);
|
||||
}
|
||||
|
||||
void cgit_print_date(time_t secs, char *format)
|
||||
{
|
||||
char buf[64];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue