Skip to contentSkip to conversation

Gitweb and submodules

DISCUSSION Jakub Narebski 3 participants 9 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
Jakub Narebski
Poland
#1 lore raw
Quoted 3 lines · Jakub Narebski

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

#2 lore raw

On Fri, 27 July 2007, Sven Verdoolaege wrote

Quoted 8 lines · Jakub Narebski
Quoted 4 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.

Signature · 2 lines
Jakub Narebski
Poland
#3 lore raw
Quoted 2 lines · Jakub Narebski

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?

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

Quoted 2 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?

skimo

#4 lore raw
Quoted 6 lines · Sven Verdoolaege
Quoted 3 lines · Jakub Narebski

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.

Quoted 5 lines
Quoted 3 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?

Quoted 5 lines
Quoted 2 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:

Quoted 1 line

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?

Signature · 2 lines
Jakub Narebski
Poland
#5 lore raw
Quoted 9 lines · Jakub Narebski
Quoted 6 lines · Sven Verdoolaege
Quoted 3 lines · Jakub Narebski

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.

Quoted 6 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?

Quoted 5 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

#6 lore raw
Quoted 4 lines · Sven Verdoolaege
Quoted 2 lines · Jakub Narebski
Quoted 1 line · Sven Verdoolaege

On Sat, Jul 28, 2007 at 12:29:16PM +0200, Jakub Narebski wrote:

Quoted 8 lines
Quoted 6 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.

Quoted 4 lines
Quoted 4 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:

Or the .git/config of superproject.

Quoted 6 lines
Quoted 1 line

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.

Signature · 2 lines
Jakub Narebski
Poland
#8 lore raw
In reply to Jakub Narebski
Quoted 3 lines · Jakub Narebski

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

Quoted 2 lines

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

#7 lore raw
In reply to Jakub Narebski
Quoted 11 lines · Jakub Narebski
Quoted 7 lines · Sven Verdoolaege
Quoted 1 line · Jakub Narebski

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