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

Re: [PATCHv2 1/2] gitweb: fixes to gitweb feature check code

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 30, 2008, 00:31 UTC
Message-ID
<200811300131.16787.jnareb@gmail.com>
In-Reply-To
<1227904793-1821-2-git-send-email-giuseppe.bilotta@gmail.com>
On Fri, 28 Nov 2008, Giuseppe Bilotta wrote:
Show 16 quoted lines
> The gitweb_check_feature routine was being used for two different
> purposes: retrieving the actual feature value (such as the list of
> snapshot formats or the list of additional actions), and to check if a
> feature was enabled.
> 
> For the latter use, since all features return an array, it led to either
> clumsy code or subtle bugs, with disabled features appearing enabled
> because (0) evaluates to 1.
> 
> We fix these bugs, and simplify the code, by separating feature (list)
> value retrieval (gitweb_get_feature) from boolean feature check (i.e.
> retrieving the first/only item in the feature value list). Usage of
> gitweb_check_feature is replaced by gitweb_get_feature where
> appropriate.
> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

I like the idea of futureproofing gitweb code to avoid further bugs with checking if feature is enabled. So from me this patch gets Ack.

I have thought at first that perhaps this patch could also remove
requirement that 'default' field is array (reference), replacing a bit
cumbersome
  $feature{'blame'}{'default'} = [1];
with simpler
  $feature{'blame'}{'default'} = 1;

But now I think that is separate issue, and if we think it is worth having (in spite of its disadvantages in form of more complicated code dealing among others with legacy configuration), it should be put in separate patch.

-- 
Jakub Narebski
Poland
Previous: Jakub NarebskiNext: Jakub Narebski
Message 24 of 26 in “[PATCHv2 0/2] fixes to gitweb feature check code”
  1. Giuseppe BilottaNov 28, 2008
  2. 1/2 gitweb: fixes to gitweb feature check codeGiuseppe Bilotta, Nov 28, 2008
  3. 2/2 gitweb: clean up git_check_feature() callsGiuseppe Bilotta, Nov 28, 2008
  4. 2/2 gitweb: clean up gitweb_check_feature() callsGiuseppe Bilotta, Nov 29, 2008
  5. Jakub NarebskiNov 29, 2008
  6. 2/2 gitweb: clean up gitweb_check_feature() callsGiuseppe Bilotta, Nov 29, 2008
  7. Junio C HamanoNov 29, 2008
  8. Junio C HamanoNov 29, 2008
  9. 2/3 gitweb: rename gitweb_check_feature to gitweb_get_featureJunio C Hamano, Nov 29, 2008
  10. 3/3 gitweb: make gitweb_check_feature a boolean wrapperJunio C Hamano, Nov 29, 2008
  11. Giuseppe BilottaNov 29, 2008
  12. Junio C HamanoNov 30, 2008
  13. Giuseppe BilottaNov 30, 2008
  14. gitweb: fixes to gitweb feature check codeGiuseppe Bilotta, Nov 30, 2008
  15. Jakub NarebskiDec 2, 2008
  16. [PATCHv3bis] gitweb: fixes to gitweb feature check codeGiuseppe Bilotta, Dec 2, 2008
  17. Junio C HamanoDec 3, 2008
  18. Junio C HamanoDec 2, 2008
  19. Jakub NarebskiDec 3, 2008
  20. Giuseppe BilottaNov 29, 2008
  21. Junio C HamanoNov 29, 2008
  22. Jakub NarebskiNov 29, 2008
  23. Jakub NarebskiNov 29, 2008
  24. Jakub NarebskiNov 30, 2008
  25. Jakub NarebskiNov 29, 2008
  26. Giuseppe BilottaNov 29, 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.