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

Re: [PATCH] gitweb: Use File::Find::find in git_get_projects_list

From
Junio C Hamano <junkio@cox.net>
Date
Sep 14, 2006, 09:40 UTC
Message-ID
<7vvenq4wgp.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200609140959.04061.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> ... But I have realized that for gitweb
> for only one project one could have ".git" as a project name,
> e.g. by putting $projectroot to be live git repository (working
> directory of git repository).

I do not understand this comment. I have /git/{git,linux-2.6} and run test gitweb with projectroot set to /git to see it can display them both. Both are with working tree, so there are /git/git/.git and /git/linux-2.6/.git directories.

Do you mean to say "project name" is always taken from the last component of the directory name and the above setup would result in ambiguity? If that is the case that sounds awful, but I haven't noticed it.

> It was intended I think to avoid adding '.' and '..' as git 
> repositories, not stray directories. Well, perhaps index file
> if it was used.

Having and not having index are both valid, so there is no value in checking the index, even if we wanted to be more paranoid. Existence of HEAD, refs/heads, and/or objects/ would be a more meaningful alternative, but again only if we wanted to be more paranoid.

Show 13 quoted lines
>> > +		File::Find::find({
>> > +			no_chdir => 1, # do not change directory
>> > +			follow_fast => 1, # follow symbolic links
>> 
>> What is the reason behind choosing follow_fast?  By saying
>> follow_anything, you choose to care about cases where there are
>> symlinks under projectroot to point at various projects.  If
>> that is the case, don't you want to make sure you include the
>> same project only once?
>
> First, it is faster. Second, for testing if it works I used copy
> of a one "live" git repository I have (git.git repository), by making
> second symlink to it.

That was not what I wanted to ask; slower and correct is always preferred over fast and incorrect. I did not see anything that compensates the duplicates follow_fast might give you in the code, so I wondered there were some other trick you used to avoid it.

In other words, "because I have such and such check to avoid duplicates, so I can safely use 'follow_fast', without using slower 'follow'" was the answer I was after.

Previous: Jakub NarebskiNext: Jakub Narebski
Message 7 of 19 in “gitweb: Use File::Find::find in git_get_projects_list”
  1. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  2. Junio C HamanoSep 14, 2006
  3. Jakub NarebskiSep 14, 2006
  4. Junio C HamanoSep 14, 2006
  5. Junio C HamanoSep 14, 2006
  6. Jakub NarebskiSep 14, 2006
  7. Junio C HamanoSep 14, 2006
  8. Jakub NarebskiSep 14, 2006
  9. Junio C HamanoSep 14, 2006
  10. Jakub NarebskiSep 14, 2006
  11. Randal L. SchwartzSep 14, 2006
  12. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  13. Jakub NarebskiSep 14, 2006
  14. Junio C HamanoSep 14, 2006
  15. Randal L. SchwartzSep 14, 2006
  16. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  17. Junio C HamanoSep 14, 2006
  18. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  19. Jakub NarebskiSep 14, 2006

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.