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

Re: [PATCH] gitweb: fixes to gitweb feature check code

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 17, 2008, 01:02 UTC
Message-ID
<200811170202.27893.jnareb@gmail.com>
In-Reply-To
<1226759165-6894-1-git-send-email-giuseppe.bilotta@gmail.com>
On Sat, 15 Nov 2008, Giuseppe Bilotta wrote:
Show 15 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 across gitweb is replaced by the appropriate call
> wherever needed.
> ---
First, you forgot the signoff, but you have addressed that already.

Second, I thought at first that it would be good for the patch to also simplify %feature hash, using "'default' => 1" instead of current bit convoluted "'default' => [1]", at the cost of bit more code for defensive programming. But now I think that if it is to be done, it should be put as separate patch.

-- 
Jakub Narebski
Poland
Previous: Giuseppe BilottaNext: Giuseppe Bilotta
Message 5 of 9 in “gitweb: fixes to gitweb feature check code”
  1. gitweb: fixes to gitweb feature check codeGiuseppe Bilotta, Nov 15, 2008
  2. Giuseppe BilottaNov 16, 2008
  3. Junio C HamanoNov 16, 2008
  4. Giuseppe BilottaNov 16, 2008
  5. Jakub NarebskiNov 17, 2008
  6. Giuseppe BilottaNov 17, 2008
  7. Jakub NarebskiNov 17, 2008
  8. Junio C HamanoNov 17, 2008
  9. Jakub NarebskiNov 17, 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.