threads / discuss / 9255

Gitweb and submodules

Subject: Gitweb and submodules

## tl;dr

9 messages between Jul 27, 2007 and Jul 30, 2007.

replies: 8people: 3as markdown or json

Jakub Narebski· Jul 27, 2007, 11:22 UTC · lore

I'd like to add submodule support to gitweb, among others marking submodules as such in the 'tree' view and adding 'log' view link to them.

But for that I need a question answered: how to find GIT_DIR of repository which contains submodule objects? We have to assume in gitweb that repositories are bare...

-- 
Jakub Narebski
Poland
Sven Verdoolaege· Jul 27, 2007, 12:32 UTC · re: Jakub Narebski · lore

Re: Gitweb and submodules

On Fri, Jul 27, 2007 at 01:22:49PM +0200, Jakub Narebski wrote:
> But for that I need a question answered: how to find GIT_DIR of 
> repository which contains submodule objects? We have to assume in 
> gitweb that repositories are bare...

You'll have to add a configuration variable for that. The submodule may not even be on the same server.

skimo
Jakub Narebski· Jul 28, 2007, 10:29 UTC · re: Sven Verdoolaege · lore

Re: Gitweb and submodules

On Fri, 27 July 2007, Sven Verdoolaege wrote
> On Fri, Jul 27, 2007 at 01:22:49PM +0200, Jakub Narebski wrote:
Show 6 quoted lines
> > But for that I need a question answered: how to find GIT_DIR of 
> > repository which contains submodule objects? We have to assume in 
> > gitweb that repositories are bare...
> 
> You'll have to add a configuration variable for that.
> The submodule may not even be on the same server.

What do you think about using "submodule.$name.gitdir" configuration variable for that? It has to be configuration variable because the location of repository which has submodule objects doesn't change when checking out (or rewinding) to different commit in supermodule.

As a special case I'd use 'no value' to note that submodule objects are contained in the supermodule repository.

-- 
Jakub Narebski
Poland
Sven Verdoolaege· Jul 28, 2007, 10:40 UTC · re: Jakub Narebski · lore

Re: Gitweb and submodules

On Sat, Jul 28, 2007 at 12:29:16PM +0200, Jakub Narebski wrote:
> What do you think about using "submodule.$name.gitdir" configuration 
> variable for that?
What will be the value?  A path relative to the gitdir of the superproject?
> It has to be configuration variable because the 
> location of repository which has submodule objects doesn't change when 
> checking out (or rewinding) to different commit in supermodule.
Let's hope Pasky provides a way to set this information...
> As a special case I'd use 'no value' to note that submodule objects are 
> contained in the supermodule repository.

How about using '.' for that and no value for submodules that are not available on this server?

skimo
Jakub Narebski· Jul 28, 2007, 20:39 UTC · re: Sven Verdoolaege · lore

Re: Gitweb and submodules

On Sat, 28 July 2007, Sven Verdoolaege wrote:
Show 6 quoted lines
> On Sat, Jul 28, 2007 at 12:29:16PM +0200, Jakub Narebski wrote:
>>
>> What do you think about using "submodule.$name.gitdir" configuration 
>> variable for that?
> 
> What will be the value?  A path relative to the gitdir of the superproject?

Or absolute path. I was thinking about absolute path, but path relative to GIT_DIR of superproject is a good idea.

Show 5 quoted lines
>> It has to be configuration variable because the 
>> location of repository which has submodule objects doesn't change when 
>> checking out (or rewinding) to different commit in supermodule.
> 
> Let's hope Pasky provides a way to set this information...
Why Pasky?
Show 5 quoted lines
>> As a special case I'd use 'no value' to note that submodule objects are 
>> contained in the supermodule repository.
> 
> How about using '.' for that and no value for submodules that
> are not available on this server?

Very good idea, both using '.' to mark that submodule objects are in the superproject objects database, and no value for not available (although I'm less sure about the latter).

I am thinking about the following sequence to search for submodule objects:

>From $GIT_DIR/config:
  submodule.$name.objects (absolute or relative to gitdir of superproject)
  submodule.$name.gitdir  (absolute or relative to gitdir of superproject)
  submodule.$name.url     (to find GIT_DIR, if it is local filesystem URL)
If there is working directory, from .gitmodules file in top level
of working directory:
  submodule.$name.path/.git (relative to toplevel of working directory)
What do you think about this?
-- 
Jakub Narebski
Poland
Sven Verdoolaege· Jul 29, 2007, 16:37 UTC · re: Jakub Narebski · lore

Re: Gitweb and submodules

On Sat, Jul 28, 2007 at 10:39:28PM +0200, Jakub Narebski wrote:
Show 9 quoted lines
> On Sat, 28 July 2007, Sven Verdoolaege wrote:
> > On Sat, Jul 28, 2007 at 12:29:16PM +0200, Jakub Narebski wrote:
> >> It has to be configuration variable because the 
> >> location of repository which has submodule objects doesn't change when 
> >> checking out (or rewinding) to different commit in supermodule.
> > 
> > Let's hope Pasky provides a way to set this information...
> 
> Why Pasky?

I was thinking about projects on repo.or.cz. We'd want to have a way to specify the locations of submodules.

Show 6 quoted lines
> I am thinking about the following sequence to search for submodule
> objects:
> 
> From $GIT_DIR/config:
>   submodule.$name.objects (absolute or relative to gitdir of superproject)
>   submodule.$name.gitdir  (absolute or relative to gitdir of superproject)
Do we really need both of these?
Show 5 quoted lines
>   submodule.$name.url     (to find GIT_DIR, if it is local filesystem URL)
> 
> If there is working directory, from .gitmodules file in top level
> of working directory:
>   submodule.$name.path/.git (relative to toplevel of working directory)

Having a relative path for the URL in .gitmodules in a public repo doesn't seem very useful to me. I know it's only meant as a default value, but if it is a relative path, then it won't work for anyone cloning the superproject.

skimo
Jakub Narebski· Jul 30, 2007, 00:09 UTC · re: Sven Verdoolaege · lore

Re: Gitweb and submodules

On Sun,29 July 2007, Sven Verdoolaege wrote:
> On Sat, Jul 28, 2007 at 10:39:28PM +0200, Jakub Narebski wrote:
>> On Sat, 28 July 2007, Sven Verdoolaege wrote:
>>> On Sat, Jul 28, 2007 at 12:29:16PM +0200, Jakub Narebski wrote:
Show 8 quoted lines
>> I am thinking about the following sequence to search for submodule
>> objects:
>> 
>> From $GIT_DIR/config:
>>   submodule.$name.objects (absolute or relative to gitdir of superproject)
>>   submodule.$name.gitdir  (absolute or relative to gitdir of superproject)
> 
> Do we really need both of these?

We need only location of object database for projects. The submodule does not need full GIT_DIR structure, with refs, config, etc.

So no, I'm not sure if we want both. They are equivalent to setting
GIT_OBJECT_DIRECTORY and GIT_DIR for submodule, respectively.
 
>>   submodule.$name.url     (to find GIT_DIR, if it is local filesystem URL)
>> 
>> If there is working directory, from .gitmodules file in top level
>> of working directory:
Or the .git/config of superproject.
Show 6 quoted lines
>>   submodule.$name.path/.git (relative to toplevel of working directory)
> 
> Having a relative path for the URL in .gitmodules in a public repo
> doesn't seem very useful to me.  I know it's only meant as a default
> value, but if it is a relative path, then it won't work for
> anyone cloning the superproject.

Erm, it should be relative path in .git/config (as in example in the t/t7400-submodule-basic.sh IIRC). And this is purely local matter.

-- 
Jakub Narebski
Poland
Sven Verdoolaege· Jul 30, 2007, 07:06 UTC · re: Jakub Narebski · lore

Re: Gitweb and submodules

On Mon, Jul 30, 2007 at 02:09:03AM +0200, Jakub Narebski wrote:
Show 11 quoted lines
> On Sun,29 July 2007, Sven Verdoolaege wrote:
> > On Sat, Jul 28, 2007 at 10:39:28PM +0200, Jakub Narebski wrote:
> >>   submodule.$name.path/.git (relative to toplevel of working directory)
> > 
> > Having a relative path for the URL in .gitmodules in a public repo
> > doesn't seem very useful to me.  I know it's only meant as a default
> > value, but if it is a relative path, then it won't work for
> > anyone cloning the superproject.
> 
> Erm, it should be relative path in .git/config (as in example in the
> t/t7400-submodule-basic.sh IIRC). And this is purely local matter.
My mistake.  I misread that as submodule.$name.url.
skimo
Lars Hjemli· Jul 27, 2007, 14:31 UTC · re: Jakub Narebski · lore

Re: Gitweb and submodules

On 7/27/07, Jakub Narebski <jnareb@gmail.com> wrote:
> I'd like to add submodule support to gitweb, among others marking
> submodules as such in the 'tree' view and adding 'log' view link to
> them.
A bit of advertising:
  http://hjemli.net/git/cgit/tree
The implementation can be found here:
  http://hjemli.net/git/cgit/tree/ui-tree.c#81
> But for that I need a question answered: how to find GIT_DIR of
> repository which contains submodule objects?

Generally, you can't. But if you just want to show the log of the submodule path, you probably don't need to do anything at all (except the special handling in 'tree' view). If you do want to show the log of the referenced repository, I guess a new entry in .gitmodules could be helpful.

-- larsh

← back to recent threads