Skip to content

Commit d20602e

Browse files
committed
gitweb: do not choke on recursive symlink
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 <gitster@pobox.com>
1 parent 6490a33 commit d20602e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,7 @@ sub git_get_projects_list {
15151515

15161516
File::Find::find({
15171517
follow_fast => 1, # follow symbolic links
1518+
follow_skip => 2, # ignore duplicates
15181519
dangling_symlinks => 0, # ignore dangling symlinks, silently
15191520
wanted => sub {
15201521
# skip project-list toplevel, if we get it.

0 commit comments

Comments
 (0)