git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: configurable home link string
@ 2006-08-14 22:50 Yasushi SHOJI
  2006-08-15 16:15 ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Yasushi SHOJI @ 2006-08-14 22:50 UTC (permalink / raw)
  To: git; +Cc: Yasushi SHOJI

I've always found difficult to figure out git URL for clone from
gitweb URL because git:// and http:// are different on many site
including kernel.org.

I've found this enhancement at http://dev.laptop.org/git when I was on
git channel, and thought that it'd be nice if all public gitweb site
show it's git URL on its page.

This patch allow us to change the home link string.  The current
default is "projects" as we all see on gitweb now.

ie. kernel.org might set this variable to "git://git.kernel.org/pub/scm/"

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
---
 Makefile           |    2 ++
 gitweb/gitweb.perl |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index a538710..b363f50 100644
--- a/Makefile
+++ b/Makefile
@@ -123,6 +123,7 @@ # DESTDIR=
 
 # default configuration for gitweb
 GITWEB_CONFIG = gitweb_config.perl
+GITWEB_HOME_LINK_STR = projects
 GITWEB_SITENAME =
 GITWEB_PROJECTROOT = /pub/git
 GITWEB_LIST =
@@ -617,6 +618,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
+	    -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
 	    -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
 	    -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
 	    -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 626fcc9..76e8376 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -36,6 +36,9 @@ our $git_temp = "/tmp/gitweb";
 # target of the home link on top of all pages
 our $home_link = $my_uri;
 
+# string of the home link on top of all pages
+our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+
 # name of your site or organization to appear in page titles
 # replace this with something more descriptive for clearer bookmarks
 our $site_name = "++GITWEB_SITENAME++" || $ENV{'SERVER_NAME'} || "Untitled";
@@ -890,7 +893,7 @@ EOF
 	      "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
 	      "<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
 	      "</a>\n";
-	print $cgi->a({-href => esc_param($home_link)}, "projects") . " / ";
+	print $cgi->a({-href => esc_param($home_link)}, $home_link_str) . " / ";
 	if (defined $project) {
 		print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, esc_html($project));
 		if (defined $action) {
-- 
1.4.2.g182a

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

* Re: [PATCH] gitweb: configurable home link string
  2006-08-14 22:50 [PATCH] gitweb: configurable home link string Yasushi SHOJI
@ 2006-08-15 16:15 ` Jakub Narebski
  2006-08-15 19:27   ` Martin Waitz
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-08-15 16:15 UTC (permalink / raw)
  To: git

Yasushi SHOJI wrote:

> I've always found difficult to figure out git URL for clone from
> gitweb URL because git:// and http:// are different on many site
> including kernel.org.
> 
> I've found this enhancement at http://dev.laptop.org/git when I was on
> git channel, and thought that it'd be nice if all public gitweb site
> show it's git URL on its page.
> 
> This patch allow us to change the home link string.  The current
> default is "projects" as we all see on gitweb now.
> 
> ie. kernel.org might set this variable to "git://git.kernel.org/pub/scm/"
> 
> Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>

There is similar improvement in gitweb-xmms2, where the git clone/fetch
URL for an individual project is visible in the "summary" page for project,
see e.g.
  http://git.xmms.se/?p=gitweb-xmms2.git;a=summary

I plan on implementing such a feature, with an improvement that URL is not
displayed if $git_base_url (your $home_link_str) is not defined (e.g.
repository is not published)... or you can reimplement this feature.
 
http://git.xmms.se/?p=gitweb-xmms2.git;a=commit;h=8e327dfbdebedd0c5fc02fe606fd4675b43237d7

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: [PATCH] gitweb: configurable home link string
  2006-08-15 16:15 ` Jakub Narebski
@ 2006-08-15 19:27   ` Martin Waitz
  2006-08-15 19:36     ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Waitz @ 2006-08-15 19:27 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

hoi :)

On Tue, Aug 15, 2006 at 06:15:05PM +0200, Jakub Narebski wrote:
> There is similar improvement in gitweb-xmms2, where the git clone/fetch
> URL for an individual project is visible in the "summary" page for project,

doesn't it make more sense to make it more easy to use the same URL for
git:, http: and gitweb?

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] gitweb: configurable home link string
  2006-08-15 19:27   ` Martin Waitz
@ 2006-08-15 19:36     ` Jakub Narebski
  2006-08-15 20:24       ` Carl Worth
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-08-15 19:36 UTC (permalink / raw)
  To: Martin Waitz; +Cc: git

On 8/15/06, Martin Waitz <tali@admingilde.org> wrote:
> On Tue, Aug 15, 2006 at 06:15:05PM +0200, Jakub Narebski wrote:
>> There is similar improvement in gitweb-xmms2, where the git clone/fetch
>> URL for an individual project is visible in the "summary" page for project,
>
> doesn't it make more sense to make it more easy to use the same URL for
> git:, http: and gitweb?

It is not always possible to use the same URL for gitweb and http://
access, for example gitweb might require /cgi-bin/ in path. git:// and
git+ssh:// access migh need different path than http:// access.

With PATH_INFO for 'project' parameter actually used gitweb link would
be the same as http:// access link; the problem would be to
differentiate which handle using gitweb.cgi, and which handle
directly.
-- 
Jakub Narebski

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

* Re: [PATCH] gitweb: configurable home link string
  2006-08-15 19:36     ` Jakub Narebski
@ 2006-08-15 20:24       ` Carl Worth
  2006-08-15 22:11         ` Martin Waitz
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Worth @ 2006-08-15 20:24 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Martin Waitz, git

[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]

On Tue, 15 Aug 2006 21:36:43 +0200, "Jakub Narebski" wrote:
> On 8/15/06, Martin Waitz <tali@admingilde.org> wrote:
> >
> > doesn't it make more sense to make it more easy to use the same URL for
> > git:, http: and gitweb?
>
> It is not always possible to use the same URL for gitweb and http://
> access, for example gitweb might require /cgi-bin/ in path. git:// and
> git+ssh:// access migh need different path than http:// access.
>
> With PATH_INFO for 'project' parameter actually used gitweb link would
> be the same as http:// access link;

And for someone who has enough control to make consistent URLs happen,
could anyone provide guidance on how to make this work? Specifically,
I'm interested in getting at the PATH_INFO for project functionality.

Currently I've got gitweb running at the root URL on its own domain
with the following apache configuration:

	ScriptAlias / /usr/lib/cgi-bin/gitweb

So I can currently browse a project with something like:

	http://gitweb.freedesktop.org/?p=cairo.git

But if I try to put the project name as part of the path:

	http://gitweb.freedesktop.org/cairo.git

Then I just get a 404. So what do I need to configure to get the
PATH_INFO stuff to work?

Also, is there support in gitweb for not requiring the ".git" suffix
even though that exists in the directory on the filesystem? The URL I
really want to use is:

	http://gitweb.freedesktop.org/cairo

Finally, once I get that working, I would like gitweb to generate URLs
of this form in the link it generates. Does it have that capability
yet? (It would also be nice if it didn't append options that are the
default anyway, such as ";a=summary").

Thanks in advance,

-Carl

PS. Oh, and then the final thing I'd want is to allow someone to cut
and paste a gitweb URL such as the above to "git clone" and then some
magic would forward things such that the git daemon would serve the
data. Has anyone got that working? And for bonus points, it would also
fail over to http:// cloning if git:// cloning weren't possible for
some reason.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] gitweb: configurable home link string
  2006-08-15 20:24       ` Carl Worth
@ 2006-08-15 22:11         ` Martin Waitz
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Waitz @ 2006-08-15 22:11 UTC (permalink / raw)
  To: Carl Worth; +Cc: Jakub Narebski, git

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

hoi :)

On Tue, Aug 15, 2006 at 01:24:40PM -0700, Carl Worth wrote:
> Currently I've got gitweb running at the root URL on its own domain
> with the following apache configuration:
> 
> 	ScriptAlias / /usr/lib/cgi-bin/gitweb

I use the following configuration:

    DocumentRoot /pub/git
    RewriteEngine on
    RewriteRule ^/(.*\.git/(.*\.html)?)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]

this has the advantage that normal http: repository accesses go to the
normal web server and only gitweb accesses go to the CGI.

> Finally, once I get that working, I would like gitweb to generate URLs
> of this form in the link it generates. Does it have that capability
> yet? (It would also be nice if it didn't append options that are the
> default anyway, such as ";a=summary").

I had this for an very old gitweb version and am currently
reimplementing it for current gitweb versions.

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2006-08-15 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-14 22:50 [PATCH] gitweb: configurable home link string Yasushi SHOJI
2006-08-15 16:15 ` Jakub Narebski
2006-08-15 19:27   ` Martin Waitz
2006-08-15 19:36     ` Jakub Narebski
2006-08-15 20:24       ` Carl Worth
2006-08-15 22:11         ` Martin Waitz

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