]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: do not choke on recursive symlink
authorJunio C Hamano <redacted>
Fri, 27 Jul 2007 08:23:03 +0000 (01:23 -0700)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:12 +0000 (00:07 -0400)
If somebody used to advertise his repository that physically
resides at /pub/lic.git/ as:

git://git.example.com/pub/lic.git/

but now wants to use --base-path to allow:

git://git.example.com/lic.git/

she can start git-daemon with --base-path option, like this:

git-daemon --base-path=/pub --export-all

During the transition, however, she would also want to allow
older URL as well.  One natural way to achieve that is to create
a symlink:

ln -s /pub /pub/pub

so that a request to git://git.example.com/pub/lic.git/ is first
translated by --base-path to a request to /pub/pub/lic.git/
which goes to /pub/lic.git, thanks to the symlink.

So far so good.

However, gitweb chokes if there is such a symlink (File::Find
barfs with "/pub/pub is a recursive symbolic link").  Make the
code ignore such a symlink.

Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 972339da499be91b809b8aa037fc4c7d6a7a5b07b528c0dccd57f058688cf3f8..84293a5d12175cb834304954bc1d17f5ee4e73164c06f530b40c265652c92ea4 100755 (executable)
@@ -1516,6 +1516,7 @@ sub git_get_projects_list {
 
                File::Find::find({
                        follow_fast => 1, # follow symbolic links
+                       follow_skip => 2, # ignore duplicates
                        dangling_symlinks => 0, # ignore dangling symlinks, silently
                        wanted => sub {
                                # skip project-list toplevel, if we get it.
This page took 0.3149 seconds and 4 git commands to generate.