2
0
mirror of https://git.zx2c4.com/cgit synced 2025-09-01 23:05:13 +00:00

ui-blame: add blame UI

Implement a page which provides the blame view of a specified file.

This feature is controlled by a new config variable, "enable-blame",
which is disabled by default.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
Jeff Smith
2017-10-01 23:39:08 -05:00
committed by John Keeping
parent f6ffe40d1a
commit c1cd290d1f
8 changed files with 265 additions and 1 deletions

12
cmd.c
View File

@@ -1,6 +1,6 @@
/* cmd.c: the cgit command dispatcher
*
* Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com>
* Copyright (C) 2006-2017 cgit Development Team <cgit@lists.zx2c4.com>
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
@@ -11,6 +11,7 @@
#include "cache.h"
#include "ui-shared.h"
#include "ui-atom.h"
#include "ui-blame.h"
#include "ui-blob.h"
#include "ui-clone.h"
#include "ui-commit.h"
@@ -63,6 +64,14 @@ static void about_fn(void)
cgit_print_site_readme();
}
static void blame_fn(void)
{
if (ctx.cfg.enable_blame)
cgit_print_blame();
else
cgit_print_error_page(403, "Forbidden", "Blame is disabled");
}
static void blob_fn(void)
{
cgit_print_blob(ctx.qry.sha1, ctx.qry.path, ctx.qry.head, 0);
@@ -164,6 +173,7 @@ struct cgit_cmd *cgit_get_cmd(void)
def_cmd(HEAD, 1, 0, 1),
def_cmd(atom, 1, 0, 0),
def_cmd(about, 0, 0, 0),
def_cmd(blame, 1, 1, 0),
def_cmd(blob, 1, 0, 0),
def_cmd(commit, 1, 1, 0),
def_cmd(diff, 1, 1, 0),