From: sebastian at breakpoint.cc (Sebastian Andrzej Siewior)
Subject: [PATCH 3/4] summary: Add tag head line in the dowload section
Date: Sat, 18 Jan 2014 21:24:59 +0100 [thread overview]
Message-ID: <1390076700-16626-4-git-send-email-sebastian@breakpoint.cc> (raw)
In-Reply-To: <1390076700-16626-1-git-send-email-sebastian@breakpoint.cc>
If the downloads are disabled one gets only ugly "commit sha1". With
downloads enabled you see the file name with different extensions a few
times.
This patches changes it a little. Instead of printing the hash number it
prints the first line of the tag i.e. the head line / commit subject if
available. With downloads enabled it prints additionally the extension
of the archive type (i.e. .tar, .tar.xz) next to it.
Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
ui-refs.c | 5 +++--
ui-tag.c | 31 +++++++++++++++++++++++++++++++
ui-tag.h | 1 +
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/ui-refs.c b/ui-refs.c
index 147b665..e0fd120 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -10,6 +10,7 @@
#include "ui-refs.h"
#include "html.h"
#include "ui-shared.h"
+#include "ui-tag.h"
static int cmp_age(int age1, int age2)
{
@@ -150,10 +151,10 @@ static int print_tag(struct refinfo *ref)
html("<tr><td>");
cgit_tag_link(name, NULL, NULL, ctx.qry.head, name);
html("</td><td>");
+ cgit_print_tag_subject(name);
+ html(" ");
if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT))
print_tag_downloads(ctx.repo, name);
- else
- cgit_object_link(obj);
html("</td><td>");
if (info) {
if (info->tagger) {
diff --git a/ui-tag.c b/ui-tag.c
index c1d1738..ef1d320 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -39,6 +39,37 @@ static void print_download_links(char *revname)
html("</td></tr>");
}
+void cgit_print_tag_subject(char *revname)
+{
+ unsigned char sha1[20];
+ struct object *obj;
+ struct taginfo *info;
+ struct tag *tag;
+ char *p;
+ size_t len;
+
+ if (get_sha1(fmt("refs/tags/%s", revname), sha1))
+ return;
+
+ obj = parse_object(sha1);
+ if (!obj)
+ return;
+
+ tag = lookup_tag(sha1);
+ if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag)))
+ return;
+
+ p = strchr(info->msg, '\n');
+ if (p)
+ *p = '\0';
+ len = strlen(info->msg);
+ if (len > 74)
+ info->msg[74] = '\0';
+
+ html_txt(info->msg);
+ free(info);
+}
+
void cgit_print_tag(char *revname)
{
struct strbuf fullref = STRBUF_INIT;
diff --git a/ui-tag.h b/ui-tag.h
index d295cdc..352e0fd 100644
--- a/ui-tag.h
+++ b/ui-tag.h
@@ -2,5 +2,6 @@
#define UI_TAG_H
extern void cgit_print_tag(char *revname);
+void cgit_print_tag_subject(char *revname);
#endif /* UI_TAG_H */
--
1.8.5.2
next prev parent reply other threads:[~2014-01-18 20:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-18 20:24 my out-of-tree patches for cgit sebastian
2014-01-18 20:24 ` [PATCH 1/4] snapshots: Don't allow sneaked in snapshots requests sebastian
2014-02-01 14:54 ` sebastian
2014-02-02 14:49 ` cgit
2014-01-18 20:24 ` [PATCH 2/4] cache: use sendfile() instead of a pair of read() + write() sebastian
2014-01-18 21:32 ` jamie.couture
2014-01-19 14:12 ` Jason
2014-01-19 14:13 ` Jason
2014-01-19 15:17 ` Jason
2014-01-18 20:24 ` sebastian [this message]
2014-01-19 14:17 ` [PATCH 3/4] summary: Add tag head line in the dowload section Jason
2014-02-02 14:43 ` cgit
2014-01-18 20:25 ` [PATCH 4/4] repolist: add a git link on front page sebastian
2014-01-19 14:19 ` Jason
2014-02-01 14:53 ` sebastian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390076700-16626-4-git-send-email-sebastian@breakpoint.cc \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).