tag: reference with "h" instead of "id"

When clicking on "log" from a tag we end up showing the log of whatever
branch we used to reach the tag.  If the tag doesn't point onto a branch
then the tagged commit won't appear in this output.

By linking to tags with the head parameter instead of the "id" parameter
the log link will show the log of the tag.  This is clearly desirable
when the tag has been reached from the refs UI and changing the
behaviour for tag decorations makes them match branch decorations where
log -> decoration -> log shows the log of the decoration.

Reported-by: Ferry Huberts <mailings@hupie.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
John Keeping 2015-01-15 22:18:14 +00:00 committed by Jason A. Donenfeld
vanhempi ed7e3bc822
commit c422b9b3d5
4 muutettua tiedostoa jossa 8 lisäystä ja 9 poistoa

Näytä tiedosto

@ -71,11 +71,11 @@ void show_commit_decorations(struct commit *commit)
}
else if (starts_with(deco->name, "tag: refs/tags/")) {
strncpy(buf, deco->name + 15, sizeof(buf) - 1);
cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
cgit_tag_link(buf, NULL, "tag-deco", buf);
}
else if (starts_with(deco->name, "refs/tags/")) {
strncpy(buf, deco->name + 10, sizeof(buf) - 1);
cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
cgit_tag_link(buf, NULL, "tag-deco", buf);
}
else if (starts_with(deco->name, "refs/remotes/")) {
if (!ctx.repo->enable_remote_branches)

Näytä tiedosto

@ -140,7 +140,7 @@ static int print_tag(struct refinfo *ref)
}
html("<tr><td>");
cgit_tag_link(name, NULL, NULL, ctx.qry.head, name);
cgit_tag_link(name, NULL, NULL, name);
html("</td><td>");
if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT))
print_tag_downloads(ctx.repo, name);

Näytä tiedosto

@ -273,9 +273,9 @@ void cgit_summary_link(const char *name, const char *title, const char *class,
}
void cgit_tag_link(const char *name, const char *title, const char *class,
const char *head, const char *rev)
const char *tag)
{
reporevlink("tag", name, title, class, head, rev, NULL);
reporevlink("tag", name, title, class, tag, NULL, NULL);
}
void cgit_tree_link(const char *name, const char *title, const char *class,
@ -443,8 +443,8 @@ static void cgit_self_link(char *name, const char *title, const char *class)
else if (!strcmp(ctx.qry.page, "summary"))
cgit_summary_link(name, title, class, ctx.qry.head);
else if (!strcmp(ctx.qry.page, "tag"))
cgit_tag_link(name, title, class, ctx.qry.head,
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL);
cgit_tag_link(name, title, class, ctx.qry.has_sha1 ?
ctx.qry.sha1 : ctx.qry.head);
else if (!strcmp(ctx.qry.page, "tree"))
cgit_tree_link(name, title, class, ctx.qry.head,
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,

Näytä tiedosto

@ -18,8 +18,7 @@ extern void cgit_index_link(const char *name, const char *title,
extern void cgit_summary_link(const char *name, const char *title,
const char *class, const char *head);
extern void cgit_tag_link(const char *name, const char *title,
const char *class, const char *head,
const char *rev);
const char *class, const char *tag);
extern void cgit_tree_link(const char *name, const char *title,
const char *class, const char *head,
const char *rev, const char *path);