List for cgit developers and users
 help / color / mirror / Atom feed
* Support for submodules in tree view?
@ 2015-03-05 18:19 terrence.j.dunnigan
  2015-03-05 18:25 ` john
  0 siblings, 1 reply; 6+ messages in thread
From: terrence.j.dunnigan @ 2015-03-05 18:19 UTC (permalink / raw)


Hi all,

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?

Thanks,

Terry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20150305/1d4329a6/attachment.html>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Support for submodules in tree view?
  2015-03-05 18:19 Support for submodules in tree view? terrence.j.dunnigan
@ 2015-03-05 18:25 ` john
  2015-03-05 18:31   ` cgit
  2015-03-06  5:58   ` terrence.j.dunnigan
  0 siblings, 2 replies; 6+ messages in thread
From: john @ 2015-03-05 18:25 UTC (permalink / raw)


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...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Support for submodules in tree view?
  2015-03-05 18:25 ` john
@ 2015-03-05 18:31   ` cgit
  2015-03-05 18:34     ` john
  2015-03-06  5:58   ` terrence.j.dunnigan
  1 sibling, 1 reply; 6+ messages in thread
From: cgit @ 2015-03-05 18:31 UTC (permalink / raw)


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;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Support for submodules in tree view?
  2015-03-05 18:31   ` cgit
@ 2015-03-05 18:34     ` john
  0 siblings, 0 replies; 6+ messages in thread
From: john @ 2015-03-05 18:34 UTC (permalink / raw)


On Thu, Mar 05, 2015 at 07:31:01PM +0100, Lukas Fleischer wrote:
> 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...

Good idea.  My one concern would be that it hinders discovery of the
module-link feature, but I think that is outweighed by the fact that it
is perfectly reasonable for someone to only want to link some of the
submodules in their system to a web interface.

> -- >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;
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Support for submodules in tree view?
  2015-03-05 18:25 ` john
  2015-03-05 18:31   ` cgit
@ 2015-03-06  5:58   ` terrence.j.dunnigan
  2015-03-06  9:09     ` john
  1 sibling, 1 reply; 6+ messages in thread
From: terrence.j.dunnigan @ 2015-03-06  5:58 UTC (permalink / raw)


Thank you.

Do you have an example or two of values for module-link? I didn't see an example on the sample config file at http://git.zx2c4.com/cgit/tree/cgitrc.5.txt

If both module-link and repo.module-link are present, would repo.module-link override the global module-link? 

Terry

-----Original Message-----
From: John Keeping [mailto:john at keeping.me.uk] 
Sent: Thursday, March 05, 2015 12:26 PM
To: Dunnigan, Terrence J
Cc: cgit at lists.zx2c4.com
Subject: Re: Support for submodules in tree view?

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...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Support for submodules in tree view?
  2015-03-06  5:58   ` terrence.j.dunnigan
@ 2015-03-06  9:09     ` john
  0 siblings, 0 replies; 6+ messages in thread
From: john @ 2015-03-06  9:09 UTC (permalink / raw)


On Fri, Mar 06, 2015 at 05:58:21AM +0000, Dunnigan, Terrence J wrote:
> Do you have an example or two of values for module-link? I didn't see
> an example on the sample config file at
> http://git.zx2c4.com/cgit/tree/cgitrc.5.txt

git-instacgit[0] autogenerates submodule links as:

	module-link=/cgit/submodule/%s/commit?id=%s

then adds the submodule repositories as something like:

	repo.url=submodule/git
	repo.path=/home/john/src/cgit/.git/modules/git

where the "repo.url" value is simply "submodule/${sm_path}".

Because this "module-link" only gets the path at which the submodule is
installed in the parent repository, I think this is hard to use in a
generic way.

> If both module-link and repo.module-link are present, would
> repo.module-link override the global module-link? 

Yes.

[0] https://github.com/johnkeeping/git-instacgit

> -----Original Message-----
> From: John Keeping [mailto:john at keeping.me.uk] 
> Sent: Thursday, March 05, 2015 12:26 PM
> To: Dunnigan, Terrence J
> Cc: cgit at lists.zx2c4.com
> Subject: Re: Support for submodules in tree view?
> 
> 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...
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-06  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 18:19 Support for submodules in tree view? terrence.j.dunnigan
2015-03-05 18:25 ` john
2015-03-05 18:31   ` cgit
2015-03-05 18:34     ` john
2015-03-06  5:58   ` terrence.j.dunnigan
2015-03-06  9:09     ` john

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).