git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFCv3 1/2] gitweb: add patch view

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Dec 4, 2008, 07:24 UTC
Message-ID
<cb7bb73a0812032324m24991c5cydec41203e738fa89@mail.gmail.com>
In-Reply-To
<200812040249.01374.jnareb@gmail.com>
On Thu, Dec 4, 2008 at 2:48 AM, Jakub Narebski <jnareb@gmail.com> wrote:
Show 13 quoted lines
> On Thu, Dec 4, 2008 at 01:20, Giuseppe Bilotta wrote:
>> On Thu, Dec 4, 2008 at 12:55 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>>>> +
>>>> +     # The maximum number of patches in a patchset generated in patch
>>>> +     # view. Set this to 0 or undef to disable patch view, or to a
>>>> +     # negative number to remove any limit.
>>>> +     'patches' => {
>>>> +             'override' => 1,
>>>> +             'default' => [16]},
>
> Errr... you need something like 'sub' => \&feature_patches for override
> to actually work, I think.
Oops, right.
Show 10 quoted lines
>> I always assumed that the disabled default was related to how invasive
>> the changes would be (to the UI or computationally-wise). As for the
>> overridability, that's actually the only reason why it would make
>> sense to put in the %feature hash ... otherwise a conf-settable
>> $patch_max (as in v2) would have been enough.
>
> Add to that the fact that this patch just adds the new view, like for
> example in the case of 'snapshot' link, which was turned on... but fact,
> it was by default not overridable. I would agree that it can be turned
> on with low limit but not overridable in introductory patch.

Ok, I'll make it non-overridable, and keep this 16 limit for starters. Or would you suggest even lower?

Show 26 quoted lines
>>>>  sub git_commitdiff {
>>>>       my $format = shift || 'html';
>>>> +
>>>> +     my $patch_max = gitweb_check_feature('patches');
>>>> +     if ($format eq 'patch') {
>>>> +             die_error(403, "Patch view not allowed") unless $patch_max;
>>>> +     }
>>>> +
>>>
>>> Should you have to pay overhead for the check-feature call even when
>>> the $format is not "patch"?
>>
>> Actually I wasn't sure if I could use my within the if block, and have
>> the value visible outside (it's used further down when picking the
>> options to pass to format-patch). And since it was used in the second
>> patch anyway to choose whether to add the 'patch' link in html view or
>> not, I just put it outside the block.
>
> You have to use _declaration_ ourside block, but assignment can happen
> inside:
>
> +     my $patch_max;
> +     if ($format eq 'patch') {
> +             $patch_max = gitweb_check_feature('patches');
> +             die_error(403, "Patch view not allowed") unless $patch_max;
> +     }
Right, stupid me.
> (Side note: doesn't it uses spaces instead of tabs for align?)
I'll check.
-- 
Giuseppe "Oblomov" Bilotta
Previous: Jakub NarebskiNext: Jakub Narebski
Message 11 of 20 in “[RFCv3 0/2] gitweb: patch view”
  1. Giuseppe BilottaDec 3, 2008
  2. 1/2 gitweb: add patch viewGiuseppe Bilotta, Dec 3, 2008
  3. 2/2 gitweb: links to patch action in commitdiff and shortlog viewGiuseppe Bilotta, Dec 3, 2008
  4. Jakub NarebskiDec 6, 2008
  5. Giuseppe BilottaDec 6, 2008
  6. Jakub NarebskiDec 6, 2008
  7. Junio C HamanoDec 3, 2008
  8. Giuseppe BilottaDec 4, 2008
  9. Junio C HamanoDec 4, 2008
  10. Jakub NarebskiDec 4, 2008
  11. Giuseppe BilottaDec 4, 2008
  12. Jakub NarebskiDec 6, 2008
  13. Junio C HamanoDec 6, 2008
  14. Jakub NarebskiDec 6, 2008
  15. Junio C HamanoDec 6, 2008
  16. Giuseppe BilottaDec 6, 2008
  17. Petr BaudisDec 6, 2008
  18. Giuseppe BilottaDec 6, 2008
  19. Jakub NarebskiDec 6, 2008
  20. Giuseppe BilottaDec 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.