All of lore.kernel.org
 help / color / mirror / Atom feed
* gitweb
@ 2012-10-28 23:56 rh
  2012-10-29  5:28 ` gitweb Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: rh @ 2012-10-28 23:56 UTC (permalink / raw)
  To: git

I'm not using gitweb I was thinking about using it and was looking at the 
cgi and saw this in this file:
https://github.com/git/git/blob/master/gitweb/gitweb.perl

I think I understand the intention but the outcome is wrong.

our %highlight_ext = (
	# main extensions, defining name of syntax;
	# see files in /usr/share/highlight/langDefs/ directory
	map { $_ => $_ }
	qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make),
	# alternate extensions, see /etc/highlight/filetypes.conf
	'h' => 'c',
	map { $_ => 'sh' } qw(bash zsh ksh),
	map { $_ => 'cpp' } qw(cxx c++ cc),
	map { $_ => 'php' } qw(php3 php4 php5 phps),
	map { $_ => 'pl' } qw(perl pm), # perhaps also 'cgi'
	map { $_ => 'make'} qw(mak mk),
	map { $_ => 'xml' } qw(xhtml html htm),
);

I think the intent is better met with this, (the print is for show)

our %he = ();
$he{'h'} = 'c';
$he{$_} = $_     for (qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make));
$he{$_} = 'cpp'  for (qw(cxx c++ cc));
$he{$_} = 'php'  for (qw(php3 php4 php5 phps));
$he{$_} = 'pl'   for (qw(cgi perl pm));
$he{$_} = 'make' for (qw(mak mk));
$he{$_} = 'xml'  for (qw(xhtml html htm));
$he{$_} = 'sh'   for (qw(bash zsh ksh));

print "$he{$_} $_\n" for(sort {$he{$a} cmp $he{$b}} keys %he);

But then again maybe I misunderstood the intent.  And maybe everyone's happy
with it as-is.

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

* Re: gitweb
  2012-10-28 23:56 gitweb rh
@ 2012-10-29  5:28 ` Jeff King
  2012-10-29  7:12   ` gitweb Jakub Narębski
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2012-10-29  5:28 UTC (permalink / raw)
  To: rh; +Cc: Jakub Narebski, git

On Sun, Oct 28, 2012 at 04:56:47PM -0700, rh wrote:

> I'm not using gitweb I was thinking about using it and was looking at the 
> cgi and saw this in this file:
> https://github.com/git/git/blob/master/gitweb/gitweb.perl
> 
> I think I understand the intention but the outcome is wrong.
> 
> our %highlight_ext = (
> 	# main extensions, defining name of syntax;
> 	# see files in /usr/share/highlight/langDefs/ directory
> 	map { $_ => $_ }
> 	qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make),
> 	# alternate extensions, see /etc/highlight/filetypes.conf
> 	'h' => 'c',
> 	map { $_ => 'sh' } qw(bash zsh ksh),
> 	map { $_ => 'cpp' } qw(cxx c++ cc),
> 	map { $_ => 'php' } qw(php3 php4 php5 phps),
> 	map { $_ => 'pl' } qw(perl pm), # perhaps also 'cgi'
> 	map { $_ => 'make'} qw(mak mk),
> 	map { $_ => 'xml' } qw(xhtml html htm),
> );

Yeah, this is wrong. The first map will eat the rest of the list, and
you will get "h => h", "cxx => cxx", and so forth. I do not know this
chunk of code, but that does not seem like it is the likely intent.

You could fix it with extra parentheses:

  our %he = (
    (map { $_ => $_ } qw(py c cpp ...)),
    'h' => 'c',
    (map { $_ => 'sh' } qw(bash zsh ksh)),
    ... etc ...
  );

> I think the intent is better met with this, (the print is for show)
> 
> our %he = ();
> $he{'h'} = 'c';
> $he{$_} = $_     for (qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make));
> $he{$_} = 'cpp'  for (qw(cxx c++ cc));
> $he{$_} = 'php'  for (qw(php3 php4 php5 phps));
> $he{$_} = 'pl'   for (qw(cgi perl pm));
> $he{$_} = 'make' for (qw(mak mk));
> $he{$_} = 'xml'  for (qw(xhtml html htm));
> $he{$_} = 'sh'   for (qw(bash zsh ksh));

That is more readable to me (though it does lose the obviousness that it
is a variable initialization).

Looks like this was broken since 592ea41 (gitweb: Refactor syntax
highlighting support, 2010-04-27). I do not use gitweb (nor highlight)
at all, but I'd guess the user-visible impact is that "*.h" files are
not correctly highlighted (unless highlight does this extension mapping
itself, but then why are we doing it here?).

Jakub, can you confirm the intent and a fix like the one above makes
things better?

-Peff

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

* Re: gitweb
  2012-10-29  5:28 ` gitweb Jeff King
@ 2012-10-29  7:12   ` Jakub Narębski
  2012-10-29  7:14     ` gitweb Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Narębski @ 2012-10-29  7:12 UTC (permalink / raw)
  To: Jeff King; +Cc: rh, git

On Mon, Oct 29, 2012 at 6:28 AM, Jeff King <peff@peff.net> wrote:
> On Sun, Oct 28, 2012 at 04:56:47PM -0700, rh wrote:
>
>> I'm not using gitweb I was thinking about using it and was looking at the
>> cgi and saw this in this file:
>> https://github.com/git/git/blob/master/gitweb/gitweb.perl
>>
>> I think I understand the intention but the outcome is wrong.
>>
>> our %highlight_ext = (
>>       # main extensions, defining name of syntax;
>>       # see files in /usr/share/highlight/langDefs/ directory
>>       map { $_ => $_ }
>>       qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make),
>>       # alternate extensions, see /etc/highlight/filetypes.conf
>>       'h' => 'c',
[...]
> Yeah, this is wrong. The first map will eat the rest of the list, and
> you will get "h => h", "cxx => cxx", and so forth. I do not know this
> chunk of code, but that does not seem like it is the likely intent.
>
> You could fix it with extra parentheses:
>
>   our %he = (
>     (map { $_ => $_ } qw(py c cpp ...)),
>     'h' => 'c',
>     (map { $_ => 'sh' } qw(bash zsh ksh)),
>     ... etc ...
>   );
>
>> I think the intent is better met with this, (the print is for show)
>>
>> our %he = ();
>> $he{'h'} = 'c';
>> $he{$_} = $_     for (qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make));
>> $he{$_} = 'cpp'  for (qw(cxx c++ cc));
[...]

> That is more readable to me (though it does lose the obviousness that it
> is a variable initialization).
>
> Looks like this was broken since 592ea41 (gitweb: Refactor syntax
> highlighting support, 2010-04-27). I do not use gitweb (nor highlight)
> at all, but I'd guess the user-visible impact is that "*.h" files are
> not correctly highlighted
>
> Jakub, can you confirm the intent and a fix like the one above makes
> things better?

Yes, either of those makes things better.

>                                   (unless highlight does this extension mapping
> itself, but then why are we doing it here?).

Highlight does extension mapping itself... but for that it needs file name,
and not to be feed file contents from pipe.

-- 
Jakub Narebski

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

* Re: gitweb
  2012-10-29  7:12   ` gitweb Jakub Narębski
@ 2012-10-29  7:14     ` Jeff King
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff King @ 2012-10-29  7:14 UTC (permalink / raw)
  To: Jakub Narębski; +Cc: rh, git

On Mon, Oct 29, 2012 at 08:12:46AM +0100, Jakub Narębski wrote:

> > Jakub, can you confirm the intent and a fix like the one above makes
> > things better?
> 
> Yes, either of those makes things better.

Thanks.

> >                                   (unless highlight does this extension mapping
> > itself, but then why are we doing it here?).
> 
> Highlight does extension mapping itself... but for that it needs file name,
> and not to be feed file contents from pipe.

Ah, that makes sense.

Richard, do you want to roll a patch that fixes it?

-Peff

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

* Re: Gitweb
  2008-09-12 12:48 Gitweb delux
@ 2008-09-12 13:27 ` Jakub Narebski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Narebski @ 2008-09-12 13:27 UTC (permalink / raw)
  To: delux; +Cc: git

delux <jared@2ndnaturestudio.com> writes:

> I posted on another subject before and thanks to all who replied to
> that, Now I want to put gitweb on my server and have read everything
> to do it but cant seem to find the files. I know that it is supposed
> to be bundled with git but I am not the one who installed git, so is
> there anywhere I can get the gitweb files?

First, what operating system, and in the case of Linux what
distribution do you use?  For example both Fedora Core and Debian (so
also all Debian-derived distributions like Ubuntu) have gitweb*
package; so it should be very simple to install this.

Because installing CGI script (or legacy mod_perl script) differs from
distribution to distribution, therefore stock RPMS from kernel.org
doesn't create gitweb package.  So you would have to either download
source tarball, or clone git repository, read gitweb/INSTALL and then
run 
  $ make gitweb/gitweb.cgi <options>
or 
  $ make configure && ./configure && make gitweb/gitweb.cgi
and simply copy the files (there is no install target for gitweb) as
described, ensuring that web server is configured to run CGI scripts
(or mod_perl scripts).


You can see gitweb at work at http://git.debian.org, and modified
gitweb at http://git.kernel.org and http://repo.or.cz.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Gitweb
@ 2008-09-12 12:48 delux
  2008-09-12 13:27 ` Gitweb Jakub Narebski
  0 siblings, 1 reply; 8+ messages in thread
From: delux @ 2008-09-12 12:48 UTC (permalink / raw)
  To: git


I posted on another subject before and thanks to all who replied to that, Now
I want to put gitweb on my server and have read everything to do it but cant
seem to find the files. I know that it is supposed to be bundled with git
but I am not the one who installed git, so is there anywhere I can get the
gitweb files? 
-- 
View this message in context: http://www.nabble.com/Gitweb-tp19455112p19455112.html
Sent from the git mailing list archive at Nabble.com.

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

* Re: gitweb
  2005-10-15 19:31 gitweb Nico -telmich- Schottelius
@ 2005-10-15 19:37 ` Nico -telmich- Schottelius
  0 siblings, 0 replies; 8+ messages in thread
From: Nico -telmich- Schottelius @ 2005-10-15 19:37 UTC (permalink / raw)
  To: git

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

Nico -telmich- Schottelius [Sat, Oct 15, 2005 at 09:31:46PM +0200]:
> 1. problems getting gitweb
> 
> [21:26] creme:build% cg-clone http://www.kernel.org/pub/scm/git/gitweb.cgi

oops, my fault: s/cgi/git/

3. Problem with "+" in filenames still exists:

http://linux.schottelius.org/cgi-bin/gitweb.cgi?p=cLinux/cinit.git;a=tree;h=45484bc0aa87c816bfe18e5eea3cddba1bddf966;hb=2c2ae29df1471b6542476fb720da5b55dc149718;f=contrib+tools

4. another error happens:

----------------------------------------------------------------------
[...]
walk d8d17b5debd37a3f0e42eba2d69d375b74f20fe9
progress: 55 objects, 248306 bytes
walk f7ab660c15b5e3cb7fee035191e0cd5160bf8299
progress: 58 objects, 262710 bytes
walk e4669df9a6f638299ebab57cc87318a2a9e24b0c
progress: 61 objects, 276940 bytes
walk f5dfb3f6a6655d4d60fdd0aaeef7b5b14226147f
progress: 63 objects, 290809 bytes
error: The requested URL returned error: 404
Getting pack list
error: The requested URL returned error: 404
Getting alternates list
error: Unable to find d263a6bd453df849c9f9211f1966c830c3cf913a under http://www.kernel.org/pub/scm/git/gitweb.git/

Cannot obtain needed commit d263a6bd453df849c9f9211f1966c830c3cf913a
while processing commit f5dfb3f6a6655d4d60fdd0aaeef7b5b14226147f.
cg-fetch: objects fetch failed
cg-clone: fetch failed
----------------------------------------------------------------------

Nico

-- 
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/)
Open Source nutures open minds and free, creative developers.

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

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

* gitweb
@ 2005-10-15 19:31 Nico -telmich- Schottelius
  2005-10-15 19:37 ` gitweb Nico -telmich- Schottelius
  0 siblings, 1 reply; 8+ messages in thread
From: Nico -telmich- Schottelius @ 2005-10-15 19:31 UTC (permalink / raw)
  To: git

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

1. problems getting gitweb

[21:26] creme:build% cg-clone http://www.kernel.org/pub/scm/git/gitweb.cgi
defaulting to local storage area
http://www.kernel.org/pub/scm/git/gitweb.cgi/HEAD:
21:27:01 FEHLER 404: Not Found.
cg-fetch: unable to get the HEAD branch
cg-clone: fetch failed

2. mysterious commit

http://www.kernel.org/git/?p=git/gitweb.git;a=commitdiff;h=0c3eb45fa414326564cb1a9692c7a22319939fc0;hp=d8f1c5c2f37433ef9ce56847d81314ea2798ac3c

Not many changes for a new release imho ;-)

[well, perhaps the release change was for the head<->branches change before]

Nico

-- 
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/)
Open Source nutures open minds and free, creative developers.

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

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

end of thread, other threads:[~2012-10-29  7:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-28 23:56 gitweb rh
2012-10-29  5:28 ` gitweb Jeff King
2012-10-29  7:12   ` gitweb Jakub Narębski
2012-10-29  7:14     ` gitweb Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2008-09-12 12:48 Gitweb delux
2008-09-12 13:27 ` Gitweb Jakub Narebski
2005-10-15 19:31 gitweb Nico -telmich- Schottelius
2005-10-15 19:37 ` gitweb Nico -telmich- Schottelius

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.