Hi there,

It used to be possible to apply the attached patches to get the about link
when opening a file:
[image: about link.png]

Since commit e1ad15d368bdeb1bffea588b93a29055c5dfb7f4, it is not possible
anymore:
git apply --verbose ../about-link-1.patch













*Checking patch ui-shared.c...Checking patch ui-shared.h...Checking patch
ui-tree.c...error: while searching for: cgit_print_layout_start();
htmlf("blob: %s (", oid_to_hex(oid)); cgit_plain_link("plain", NULL, NULL,
ctx.qry.head,        rev, path); if (ctx.cfg.enable_blame) {error: patch
failed: ui-tree.c:108error: ui-tree.c: patch does not apply*

BTW, why haven't those patches been committed to the master branch? They
are quite old and work fine.
-- 
Jean-Christophe
---
 ui-shared.c | 6 ++++++
 ui-shared.h | 3 +++
 ui-tree.c   | 3 +++
 3 files changed, 12 insertions(+)

diff --git a/ui-shared.c b/ui-shared.c
index 7a4c726..a955430 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -345,6 +345,12 @@ void cgit_tree_link(const char *name, const char *title, const char *class,
 	reporevlink("tree", name, title, class, head, rev, path);
 }
 
+void cgit_about_link(const char *name, const char *title, const char *class,
+		     const char *head, const char *rev, const char *path)
+{
+	reporevlink("about", name, title, class, head, rev, path);
+}
+
 void cgit_plain_link(const char *name, const char *title, const char *class,
 		     const char *head, const char *rev, const char *path)
 {
diff --git a/ui-shared.h b/ui-shared.h
index 6964873..e01d5d8 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -24,6 +24,9 @@ extern void cgit_tag_link(const char *name, const char *title,
 extern void cgit_tree_link(const char *name, const char *title,
 			   const char *class, const char *head,
 			   const char *rev, const char *path);
+extern void cgit_about_link(const char *name, const char *title,
+			    const char *class, const char *head,
+			    const char *rev, const char *path);
 extern void cgit_plain_link(const char *name, const char *title,
 			    const char *class, const char *head,
 			    const char *rev, const char *path);
diff --git a/ui-tree.c b/ui-tree.c
index df8ad82..7b45da6 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -108,6 +108,9 @@ static void print_object(const struct object_id *oid, char *path, const char *ba
 
 	cgit_print_layout_start();
 	htmlf("blob: %s (", oid_to_hex(oid));
+	cgit_about_link("about", NULL, NULL, ctx.qry.head,
+		        rev, path);
+	html(") (");
 	cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
 		        rev, path);
 	if (ctx.cfg.enable_blame) {
---
 ui-tree.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui-tree.c b/ui-tree.c
index 7b45da6..8b12e7c 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -254,6 +254,9 @@ static int ls_item(const struct object_id *oid, struct strbuf *base,
 	if (!S_ISGITLINK(mode))
 		cgit_plain_link("plain", NULL, "button", ctx.qry.head,
 				walk_tree_ctx->curr_rev, fullpath.buf);
+	if (!S_ISDIR(mode))
+		cgit_about_link("about", NULL, "button", ctx.qry.head,
+				walk_tree_ctx->curr_rev, fullpath.buf);
 	if (!S_ISDIR(mode) && ctx.cfg.enable_blame)
 		cgit_blame_link("blame", NULL, "button", ctx.qry.head,
 				walk_tree_ctx->curr_rev, fullpath.buf);

_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to