# [PATCH] gitweb.perl: fix %highlight_ext

6 messages from 2012-10-29 to 2012-11-04. Participants: rh, Jeff King.
Thread: https://gitlist.dev/t/31971

## rh, 2012-10-29 16:42

Subject: [PATCH] gitweb.perl: fix %highlight_ext
Message-ID: <20121029094207.deafafed22ea70fbc4fbd4bb@lavabit.com>
URL: https://gitlist.dev/e/20121029094207.deafafed22ea70fbc4fbd4bb%40lavabit.com

```
I also consolidated exts where applicable.
i.e. c and h maps to c


-- 

diff --git a/a/gitweb.cgi b/b/gitweb.cgi
index 060db27..155b238 100755
--- a/a/gitweb.cgi
+++ b/b/gitweb.cgi
@@ -246,19 +246,19 @@ our %highlight_basename = (
        'Makefile' => 'make',
 );
 # match by extension
+
 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),
+       (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat ini spec tcl sql)),
        # 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),
+       (map { $_ => 'c'   } qw(c h)),
+       (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
+       (map { $_ => 'cpp' } qw(cpp cxx c++ cc)),
+       (map { $_ => 'php' } qw(php php3 php4 php5 phps)),
+       (map { $_ => 'pl'  } qw(pl perl pm)), # perhaps also 'cgi'
+       (map { $_ => 'make'} qw(make mak mk)),
+       (map { $_ => 'xml' } qw(xml xhtml html htm)),
 );
 
 # You define site-wide feature defaults here; override them with

```

## Jeff King, 2012-11-02 14:54

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext
Message-ID: <20121102145425.GC11170@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20121102145425.GC11170%40sigill.intra.peff.net
In-Reply-To: <20121029094207.deafafed22ea70fbc4fbd4bb@lavabit.com>

```
On Mon, Oct 29, 2012 at 09:42:07AM -0700, rh wrote:

> I also consolidated exts where applicable.
> i.e. c and h maps to c
> 
> 
> -- 
> 
> diff --git a/a/gitweb.cgi b/b/gitweb.cgi
> index 060db27..155b238 100755
> --- a/a/gitweb.cgi
> +++ b/b/gitweb.cgi
> @@ -246,19 +246,19 @@ our %highlight_basename = (
>         'Makefile' => 'make',
>  );
>  # match by extension
> +
>  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),
> +       (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat ini spec tcl sql)),
>         # 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),
> +       (map { $_ => 'c'   } qw(c h)),
> +       (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
> +       (map { $_ => 'cpp' } qw(cpp cxx c++ cc)),
> +       (map { $_ => 'php' } qw(php php3 php4 php5 phps)),
> +       (map { $_ => 'pl'  } qw(pl perl pm)), # perhaps also 'cgi'
> +       (map { $_ => 'make'} qw(make mak mk)),
> +       (map { $_ => 'xml' } qw(xml xhtml html htm)),

I think the patch itself looks OK, but:

  1. It isn't formatted to apply with git-am. Please use
     git-format-patch.

  2. The commit message does not explain the reason for the change.

  3. It isn't signed-off.

The first two are things I can fix up (though it is inconvenient for me
to do so), but the third is a show-stopper.  Please look through
Documentation/SubmittingPatches, especially the bit about the
Developer's Certificate of Origin, and re-send.

-Peff

```

## rh, 2012-11-02 17:41

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext
Message-ID: <20121102104121.4f81a160e4e6368dde3a8373@lavabit.com>
URL: https://gitlist.dev/e/20121102104121.4f81a160e4e6368dde3a8373%40lavabit.com
In-Reply-To: <20121102145425.GC11170@sigill.intra.peff.net>

```
On Fri, 2 Nov 2012 10:54:25 -0400
Jeff King <peff@peff.net> wrote:

> On Mon, Oct 29, 2012 at 09:42:07AM -0700, rh wrote:
> 
> > I also consolidated exts where applicable.
> > i.e. c and h maps to c
> > 
> > 
> > -- 
> > 
> > diff --git a/a/gitweb.cgi b/b/gitweb.cgi
> > index 060db27..155b238 100755
> > --- a/a/gitweb.cgi
> > +++ b/b/gitweb.cgi
> > @@ -246,19 +246,19 @@ our %highlight_basename = (
> >         'Makefile' => 'make',
> >  );
> >  # match by extension
> > +
> >  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),
> > +       (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat
> > ini spec tcl sql)),
> >         # 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),
> > +       (map { $_ => 'c'   } qw(c h)),
> > +       (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
> > +       (map { $_ => 'cpp' } qw(cpp cxx c++ cc)),
> > +       (map { $_ => 'php' } qw(php php3 php4 php5 phps)),
> > +       (map { $_ => 'pl'  } qw(pl perl pm)), # perhaps also 'cgi'
> > +       (map { $_ => 'make'} qw(make mak mk)),
> > +       (map { $_ => 'xml' } qw(xml xhtml html htm)),
> 
> I think the patch itself looks OK, but:
> 
>   1. It isn't formatted to apply with git-am. Please use
>      git-format-patch.
> 
>   2. The commit message does not explain the reason for the change.
> 
>   3. It isn't signed-off.
> 
> The first two are things I can fix up (though it is inconvenient for
> me to do so), but the third is a show-stopper.  Please look through
> Documentation/SubmittingPatches, especially the bit about the
> Developer's Certificate of Origin, and re-send.
> 
> -Peff

Thanks for taking the time to explain the workflow. If I can figure all this
out I will try to do what's needed.  This is feeling like a strange cult
that I've bumped into!

-- 
"...she's got smarts and never farts and owns a chain of liquor stores."


```

## rh, 2012-11-02 21:18

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext
Message-ID: <20121102141809.caf5cbc07f08769fd6a302ad@lavabit.com>
URL: https://gitlist.dev/e/20121102141809.caf5cbc07f08769fd6a302ad%40lavabit.com
In-Reply-To: <20121102145425.GC11170@sigill.intra.peff.net>

```
Peff and the Final Arbiter,

On Fri, 2 Nov 2012 10:54:25 -0400
Jeff King <peff@peff.net> wrote:

> On Mon, Oct 29, 2012 at 09:42:07AM -0700, rh wrote:
> 
> > I also consolidated exts where applicable.
> > i.e. c and h maps to c
> > 
> > 
> > -- 
> > 
> > diff --git a/a/gitweb.cgi b/b/gitweb.cgi
> > index 060db27..155b238 100755
> > --- a/a/gitweb.cgi
> > +++ b/b/gitweb.cgi
> > @@ -246,19 +246,19 @@ our %highlight_basename = (
> >         'Makefile' => 'make',
> >  );
> >  # match by extension
> > +
> >  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),
> > +       (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat
> > ini spec tcl sql)),
> >         # 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),
> > +       (map { $_ => 'c'   } qw(c h)),
> > +       (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
> > +       (map { $_ => 'cpp' } qw(cpp cxx c++ cc)),
> > +       (map { $_ => 'php' } qw(php php3 php4 php5 phps)),
> > +       (map { $_ => 'pl'  } qw(pl perl pm)), # perhaps also 'cgi'
> > +       (map { $_ => 'make'} qw(make mak mk)),
> > +       (map { $_ => 'xml' } qw(xml xhtml html htm)),
> 
> I think the patch itself looks OK, but:
> 
>   1. It isn't formatted to apply with git-am. Please use
>      git-format-patch.

git format-patch command wouldn't work for me. I can see that you
don't need more stuff to do but not knowing git I couldn't find the
correct incantation to do this part. A problem with the files not
being in a git repo I think. I'll spare you details.

> 
>   2. The commit message does not explain the reason for the change.
> 
>   3. It isn't signed-off.

These I've done and submitted the patch again. (even though format
is probably not going to work with git-am.

> 
> The first two are things I can fix up (though it is inconvenient for
> me to do so), but the third is a show-stopper.  Please look through
> Documentation/SubmittingPatches, especially the bit about the
> Developer's Certificate of Origin, and re-send.
> 
> -Peff

Thanks for your patience and help.


```

## Jeff King, 2012-11-04 13:45

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext
Message-ID: <20121104134503.GB31623@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20121104134503.GB31623%40sigill.intra.peff.net
In-Reply-To: <20121102141809.caf5cbc07f08769fd6a302ad@lavabit.com>

```
On Fri, Nov 02, 2012 at 02:18:09PM -0700, rh wrote:

> > I think the patch itself looks OK, but:
> > 
> >   1. It isn't formatted to apply with git-am. Please use
> >      git-format-patch.
> 
> git format-patch command wouldn't work for me. I can see that you
> don't need more stuff to do but not knowing git I couldn't find the
> correct incantation to do this part. A problem with the files not
> being in a git repo I think. I'll spare you details.

The usual procedure is:

  1. hack hack hack

  2. git commit

  3. git format-patch

And if you are not in a git repo, step 0 is "git init". :)

-Peff

```

## rh, 2012-11-04 17:43

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext
Message-ID: <20121104094309.d9d93e7e88e24d6d07be7cb0@lavabit.com>
URL: https://gitlist.dev/e/20121104094309.d9d93e7e88e24d6d07be7cb0%40lavabit.com
In-Reply-To: <20121104134503.GB31623@sigill.intra.peff.net>

```
On Sun, 4 Nov 2012 08:45:03 -0500
Jeff King <peff@peff.net> wrote:

> On Fri, Nov 02, 2012 at 02:18:09PM -0700, rh wrote:
> 
> > > I think the patch itself looks OK, but:
> > > 
> > >   1. It isn't formatted to apply with git-am. Please use
> > >      git-format-patch.
> > 
> > git format-patch command wouldn't work for me. I can see that you
> > don't need more stuff to do but not knowing git I couldn't find the
> > correct incantation to do this part. A problem with the files not
> > being in a git repo I think. I'll spare you details.
> 
> The usual procedure is:
> 
>   1. hack hack hack
> 
>   2. git commit
> 
>   3. git format-patch

Roger wilco.

> 
> And if you are not in a git repo, step 0 is "git init". :)

I had an inkling but nothing more.

Thanks again for the help!

> 
> -Peff


-- 



```
