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

Re: [PATCH v3 3/3] gitweb: Optional grouping of projects by category

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 5, 2008, 10:45 UTC
Message-ID
<200812051145.09732.jnareb@gmail.com>
In-Reply-To
<87bpvr1hee.wl%seb@cine7.net>
On Fri, 5 Dec 2008 at 03:32, Sébastien Cevey wrote:
Show 8 quoted lines
> At Fri, 5 Dec 2008 03:08:52 +0100, Jakub Narebski wrote:
> 
> > Nice... but perhaps it would be better to simply pass $from / $to to
> > build_projlist_by_category function, and have in %categories only
> > projects which are shown...
> 
> Ah you're right, we could do that, I hadn't thought of it.  Sounds
> cleaner than the $from/$to dance I did in this patch.

Usually simpler is better. The more complicated code, the more chances for bugs, and less maintability. I haven't even tried to follow $from/$to updating logic, but noticed that we can simply pass $from and $to to build_projlist_by_category(), and use loop $from..$to there.

Show 19 quoted lines
> > well, unless filtered out in print_project_rows() by $show_ctags; so
> > I think that there is nonzero probability of empty (no project
> > shown) categories.
> 
> Mh indeed, in fact this could happen any time we reach one of the
> 'next' statements in the loop in print_project_rows(), when performing
> search, tag filtering, etc...
> 
> Actually, assuming the project list is split into page, this can also
> lead to empty pages (if no project on the page matches the filter).
> To avoid empty categories, it's a bit tricky since the header is
> printed before we determine whether there are matching projects..
> 
> I need to read the code more carefully, but it seems that one solution
> would be to add a function that determines whether a project should be
> displayed or not (according to tags and search and forks); then we can
> map this function on the list of projects.
> 
> I could do it if it sounds sane to you.

Nah, I think it would be best to postpone dealing with this issue, and keep the code simple at the cost of possibly empty categories. It is not as empty categories are an actual error...

I guess that correct way to deal with this would be to filter projects earlier, before grouping by category, and not "at the last minute", when displaying them. It might be even better solution wrt. dividing projects list into pages. But that in my opinion is certainly matter for a separate patch.

> > I'll try to examine the code in more detail later... currently I don't
> > know why but I can't git-am the second patch (this patch) correctly...
> 
> This is the third patch, are you sure you applied 1 and 2 before?
 
Somehow I couldn't apply second patch in series:
 $ git am -3 -u "[PATCH v3 2_3] gitweb: Split git_project_list_body in two functions.txt"
 Applying: gitweb: Split git_project_list_body in two functions
 error: patch failed: gitweb/gitweb.perl:3972
 error: gitweb/gitweb.perl: patch does not apply
 fatal: sha1 information is lacking or useless (gitweb/gitweb.perl).
 Repository lacks necessary blobs to fall back on 3-way merge.
 Cannot fall back to three-way merge.
 Patch failed at 0001.
 
> Thanks for your careful and supportive comments!
You are welcome. Nice to have another gitweb developer :-)
-- 
Jakub Narebski
Poland
Previous: Sébastien CeveyNext: Sébastien Cevey
Message 14 of 24 in “gitweb: Optional grouping of projects by category”
  1. gitweb: Optional grouping of projects by categorySebastien Cevey, Dec 2, 2008
  2. Jakub NarebskiDec 2, 2008
  3. gitweb: Optional grouping of projects by categorySébastien Cevey, Dec 3, 2008
  4. Junio C HamanoDec 3, 2008
  5. Jakub NarebskiDec 3, 2008
  6. 0/3 gitweb: Optional grouping of projects by categorySébastien Cevey, Dec 4, 2008
  7. Junio C HamanoDec 4, 2008
  8. 1/3 gitweb: Modularized git_get_project_description to be more genericSébastien Cevey, Dec 4, 2008
  9. 2/3 gitweb: Split git_project_list_body in two functionsSébastien Cevey, Dec 4, 2008
  10. 3/3 gitweb: Optional grouping of projects by categorySébastien Cevey, Dec 4, 2008
  11. Junio C HamanoDec 4, 2008
  12. Jakub NarebskiDec 5, 2008
  13. Sébastien CeveyDec 5, 2008
  14. Jakub NarebskiDec 5, 2008
  15. Sébastien CeveyDec 11, 2008
  16. Jakub NarebskiDec 12, 2008
  17. Sébastien CeveyDec 12, 2008
  18. Jakub NarebskiDec 12, 2008
  19. Sébastien CeveyDec 12, 2008
  20. Jakub NarebskiDec 12, 2008
  21. Jakub NarebskiDec 5, 2008
  22. Jakub NarebskiDec 5, 2008
  23. Sébastien CeveyDec 3, 2008
  24. Junio C HamanoDec 3, 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.