git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitweb.cgi bug
@ 2014-02-08 13:37 Dongsheng Song
  2014-02-08 16:29 ` Andrew Keller
  0 siblings, 1 reply; 5+ messages in thread
From: Dongsheng Song @ 2014-02-08 13:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Thu, Feb 6, 2014 at 7:01 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> The latest maintenance release Git v1.8.5.4 is now available at
> the usual places.
>

I have an git repo PROJECT.git, the full path is /srv/repo/git/PROJECT.git,
when I set git_base_url_list in gitweb.conf:

@git_base_url_list = qw(https://192.168.30.239/repo/git
                            git@192.168.30.239:repo/git);

I got the result:

https://192.168.30.239/repo/git/PROJECT.git
git@192.168.30.239:/PROJECT.git

This is wrong, it should be (without the leading '/')
git@192.168.30.239:PROJECT.git

Regards,
Dongsheng

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

* Re: gitweb.cgi bug
  2014-02-08 13:37 gitweb.cgi bug Dongsheng Song
@ 2014-02-08 16:29 ` Andrew Keller
  2014-02-09  3:19   ` Dongsheng Song
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Keller @ 2014-02-08 16:29 UTC (permalink / raw)
  To: Dongsheng Song; +Cc: Git List

On Feb 8, 2014, at 8:37 AM, Dongsheng Song wrote:

> I have an git repo PROJECT.git, the full path is /srv/repo/git/PROJECT.git,
> when I set git_base_url_list in gitweb.conf:
> 
> @git_base_url_list = qw(https://192.168.30.239/repo/git
>                            git@192.168.30.239:repo/git);
> 
> I got the result:
> 
> https://192.168.30.239/repo/git/PROJECT.git
> git@192.168.30.239:/PROJECT.git
> 
> This is wrong, it should be (without the leading '/')
> git@192.168.30.239:PROJECT.git

There is no way to generate a fetch url of 'git@192.168.30.239:PROJECT.git' in gitweb.

If one of the base urls was 'git@192.168.30.239:.', then you could get a fetch URL of 'git@192.168.30.239:./PROJECT.git'

In general, though, I like to stay away from relative paths.  Weird things can happen, like HTTP works but SSH doesn't, because the home directory for SSH changed because you used a different user.

 - Andrew

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

* Re: gitweb.cgi bug
  2014-02-08 16:29 ` Andrew Keller
@ 2014-02-09  3:19   ` Dongsheng Song
  2014-02-09 16:06     ` Andrew Keller
  0 siblings, 1 reply; 5+ messages in thread
From: Dongsheng Song @ 2014-02-09  3:19 UTC (permalink / raw)
  To: Andrew Keller; +Cc: Git List

On Sun, Feb 9, 2014 at 12:29 AM, Andrew Keller <andrew@kellerfarm.com> wrote:
> On Feb 8, 2014, at 8:37 AM, Dongsheng Song wrote:
>
>> I have an git repo PROJECT.git, the full path is /srv/repo/git/PROJECT.git,
>> when I set git_base_url_list in gitweb.conf:
>>
>> @git_base_url_list = qw(https://192.168.30.239/repo/git
>>                            git@192.168.30.239:repo/git);
>>
>> I got the result:
>>
>> https://192.168.30.239/repo/git/PROJECT.git
>> git@192.168.30.239:/PROJECT.git
>>
>> This is wrong, it should be (without the leading '/')
>> git@192.168.30.239:PROJECT.git
>
> There is no way to generate a fetch url of 'git@192.168.30.239:PROJECT.git' in gitweb.
>
> If one of the base urls was 'git@192.168.30.239:.', then you could get a fetch URL of 'git@192.168.30.239:./PROJECT.git'
>
> In general, though, I like to stay away from relative paths.  Weird things can happen, like HTTP works but SSH doesn't, because the home directory for SSH changed because you used a different user.
>
>  - Andrew
>

What's about the following translate rules ?

git@192.168.30.239:  -> git@192.168.30.239:PROJECT.git
git@192.168.30.239:/ -> git@192.168.30.239:/PROJECT.git
git@192.168.30.239:/repo  -> git@192.168.30.239:/repo/PROJECT.git
git@192.168.30.239:/repo/ -> git@192.168.30.239:/repo/PROJECT.git

I don't know Perl, but I think change the following translate code is
not a hard work:

        # use per project git URL list in $projectroot/$project/cloneurl
        # or make project git URL from git base URL and project name
        my $url_tag = "URL";
        my @url_list = git_get_project_url_list($project);
        @url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
        foreach my $git_url (@url_list) {
                next unless $git_url;
                print format_repo_url($url_tag, $git_url);
                $url_tag = "";
        }

Regards,
Dongsheng

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

* Re: gitweb.cgi bug
  2014-02-09  3:19   ` Dongsheng Song
@ 2014-02-09 16:06     ` Andrew Keller
  2014-02-10 12:45       ` Dongsheng Song
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Keller @ 2014-02-09 16:06 UTC (permalink / raw)
  To: Dongsheng Song; +Cc: Git List

On Feb 8, 2014, at 10:19 PM, Dongsheng Song wrote:
> On Sun, Feb 9, 2014 at 12:29 AM, Andrew Keller <andrew@kellerfarm.com> wrote:
>> On Feb 8, 2014, at 8:37 AM, Dongsheng Song wrote:
>> 
>>> I have an git repo PROJECT.git, the full path is /srv/repo/git/PROJECT.git,
>>> when I set git_base_url_list in gitweb.conf:
>>> 
>>> @git_base_url_list = qw(https://192.168.30.239/repo/git
>>>                           git@192.168.30.239:repo/git);
>>> 
>>> I got the result:
>>> 
>>> https://192.168.30.239/repo/git/PROJECT.git
>>> git@192.168.30.239:/PROJECT.git
>>> 
>>> This is wrong, it should be (without the leading '/')
>>> git@192.168.30.239:PROJECT.git
>> 
>> There is no way to generate a fetch url of 'git@192.168.30.239:PROJECT.git' in gitweb.
>> 
>> If one of the base urls was 'git@192.168.30.239:.', then you could get a fetch URL of 'git@192.168.30.239:./PROJECT.git'
>> 
>> In general, though, I like to stay away from relative paths.  Weird things can happen, like HTTP works but SSH doesn't, because the home directory for SSH changed because you used a different user.
> 
> What's about the following translate rules ?
> 
> git@192.168.30.239:  -> git@192.168.30.239:PROJECT.git
> git@192.168.30.239:/ -> git@192.168.30.239:/PROJECT.git
> git@192.168.30.239:/repo  -> git@192.168.30.239:/repo/PROJECT.git
> git@192.168.30.239:/repo/ -> git@192.168.30.239:/repo/PROJECT.git

I think that those translation rules are completely reasonable.

However, that's not what gitweb was originally designed to do.  What you're describing is a desire for a new feature, not the existence of a bug.  Basically, gitweb does not support relative paths when the base url does not contain part of the path already.

> I don't know Perl, but I think change the following translate code is
> not a hard work:
> 
>        # use per project git URL list in $projectroot/$project/cloneurl
>        # or make project git URL from git base URL and project name
>        my $url_tag = "URL";
>        my @url_list = git_get_project_url_list($project);
>        @url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
>        foreach my $git_url (@url_list) {
>                next unless $git_url;
>                print format_repo_url($url_tag, $git_url);
>                $url_tag = "";
>        }

You're right - that is where the change should be applied, and the change you suggest is pretty simple.

However, I'm not confident that the syntax for a relative path is the same for all schemes.  (Others on the list, feel free to object.)  Since gitweb blindly concatenates the base URL and the relative project path, I'm worried that adding the proper functionality for one scheme will yield incorrect behavior for another scheme.

Can you move your repository to a subfolder?  Can use use absolute paths instead of relative paths?  Either of those approaches work around this issue.  I don't mean to coldly tell you that the solution is "don't do that", but on the surface, this seems like a nasty problem.

 - Andrew

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

* Re: gitweb.cgi bug
  2014-02-09 16:06     ` Andrew Keller
@ 2014-02-10 12:45       ` Dongsheng Song
  0 siblings, 0 replies; 5+ messages in thread
From: Dongsheng Song @ 2014-02-10 12:45 UTC (permalink / raw)
  To: Andrew Keller; +Cc: Git List

On Mon, Feb 10, 2014 at 12:06 AM, Andrew Keller <andrew@kellerfarm.com> wrote:
> On Feb 8, 2014, at 10:19 PM, Dongsheng Song wrote:
>> On Sun, Feb 9, 2014 at 12:29 AM, Andrew Keller <andrew@kellerfarm.com> wrote:
>>> On Feb 8, 2014, at 8:37 AM, Dongsheng Song wrote:
>>>
>>>> I have an git repo PROJECT.git, the full path is /srv/repo/git/PROJECT.git,
>>>> when I set git_base_url_list in gitweb.conf:
>>>>
>>>> @git_base_url_list = qw(https://192.168.30.239/repo/git
>>>>                           git@192.168.30.239:repo/git);
>>>>
>>>> I got the result:
>>>>
>>>> https://192.168.30.239/repo/git/PROJECT.git
>>>> git@192.168.30.239:/PROJECT.git
>>>>
>>>> This is wrong, it should be (without the leading '/')
>>>> git@192.168.30.239:PROJECT.git
>>>
>>> There is no way to generate a fetch url of 'git@192.168.30.239:PROJECT.git' in gitweb.
>>>
>>> If one of the base urls was 'git@192.168.30.239:.', then you could get a fetch URL of 'git@192.168.30.239:./PROJECT.git'
>>>
>>> In general, though, I like to stay away from relative paths.  Weird things can happen, like HTTP works but SSH doesn't, because the home directory for SSH changed because you used a different user.
>>
>> What's about the following translate rules ?
>>
>> git@192.168.30.239:  -> git@192.168.30.239:PROJECT.git
>> git@192.168.30.239:/ -> git@192.168.30.239:/PROJECT.git
>> git@192.168.30.239:/repo  -> git@192.168.30.239:/repo/PROJECT.git
>> git@192.168.30.239:/repo/ -> git@192.168.30.239:/repo/PROJECT.git
>
> I think that those translation rules are completely reasonable.
>
> However, that's not what gitweb was originally designed to do.  What you're describing is a desire for a new feature, not the existence of a bug.  Basically, gitweb does not support relative paths when the base url does not contain part of the path already.
>
>> I don't know Perl, but I think change the following translate code is
>> not a hard work:
>>
>>        # use per project git URL list in $projectroot/$project/cloneurl
>>        # or make project git URL from git base URL and project name
>>        my $url_tag = "URL";
>>        my @url_list = git_get_project_url_list($project);
>>        @url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
>>        foreach my $git_url (@url_list) {
>>                next unless $git_url;
>>                print format_repo_url($url_tag, $git_url);
>>                $url_tag = "";
>>        }
>
> You're right - that is where the change should be applied, and the change you suggest is pretty simple.
>
> However, I'm not confident that the syntax for a relative path is the same for all schemes.  (Others on the list, feel free to object.)  Since gitweb blindly concatenates the base URL and the relative project path, I'm worried that adding the proper functionality for one scheme will yield incorrect behavior for another scheme.
>
> Can you move your repository to a subfolder?  Can use use absolute paths instead of relative paths?  Either of those approaches work around this issue.  I don't mean to coldly tell you that the solution is "don't do that", but on the surface, this seems like a nasty problem.
>
>  - Andrew
>

Thanks, I hope this 'new feature' will translate into reality, and not
take too long.

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

end of thread, other threads:[~2014-02-10 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-08 13:37 gitweb.cgi bug Dongsheng Song
2014-02-08 16:29 ` Andrew Keller
2014-02-09  3:19   ` Dongsheng Song
2014-02-09 16:06     ` Andrew Keller
2014-02-10 12:45       ` Dongsheng Song

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