From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: Support for submodules in tree view?
Date: Thu, 05 Mar 2015 19:31:01 +0100 [thread overview]
Message-ID: <20150305183101.14312.67532@s-8d3a28b1.on.site.uni-stuttgart.de> (raw)
In-Reply-To: <20150305182553.GF1369@serenity.lan>
On Thu, 05 Mar 2015 at 19:25:53, John Keeping wrote:
> On Thu, Mar 05, 2015 at 06:19:31PM +0000, Dunnigan, Terrence J wrote:
> > We are using cgit 0.10.1. Some of our repos have submodules, and when
> > I look at a tree view I see the name of the submodule with its current
> > hash, e.g.
> >
> > m--------- Utilities @ 350bc94
> >
> > The submodule names are all hyperlinks, but the actual link is just a
> > "#". So clicking on it doesn't do anything.
> >
> > Is this the correct behavior? Or something on my system improperly
> > configured to support submodules?
>
> You probably need to set the "module-link" configuration variable in
> your cgitrc file.
>
> Since it's possible for submodules to link to a different server, there
> isn't really much CGit can do in the general case. Note that there's
> also "repo.module-link.<path>" in case your submodule paths don't match
> up to their URLs, although I'm quite surprised we don't support a filter
> to map submodule URLs to links - something to go on the TODO list
> perhaps...
What do you think about hiding the "#" link, though? I don't think it is
a good idea to pretend there is a link when there isn't...
-- >8 --
diff --git a/ui-shared.c b/ui-shared.c
index ff03cb2..0eeab6f 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -555,25 +555,27 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
item = lookup_path(list, path);
}
}
- html("<a ");
- if (class)
- htmlf("class='%s' ", class);
- html("href='");
- if (item) {
- html_attrf(item->util, rev);
- } else if (ctx.repo->module_link) {
- dir = strrchr(path, '/');
- if (dir)
- dir++;
- else
- dir = path;
- html_attrf(ctx.repo->module_link, dir, rev);
+ if (item || ctx.repo->module_link) {
+ html("<a ");
+ if (class)
+ htmlf("class='%s' ", class);
+ html("href='");
+ if (item) {
+ html_attrf(item->util, rev);
+ } else {
+ dir = strrchr(path, '/');
+ if (dir)
+ dir++;
+ else
+ dir = path;
+ html_attrf(ctx.repo->module_link, dir, rev);
+ }
+ html("'>");
+ html_txt(path);
+ html("</a>");
} else {
- html("#");
+ html_txt(path);
}
- html("'>");
- html_txt(path);
- html("</a>");
html_txtf(" @ %.7s", rev);
if (item && tail)
path[len - 1] = tail;
next prev parent reply other threads:[~2015-03-05 18:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 18:19 terrence.j.dunnigan
2015-03-05 18:25 ` john
2015-03-05 18:31 ` cgit [this message]
2015-03-05 18:34 ` john
2015-03-06 5:58 ` terrence.j.dunnigan
2015-03-06 9:09 ` john
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=20150305183101.14312.67532@s-8d3a28b1.on.site.uni-stuttgart.de \
--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).