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

From: Junio C Hamano <>
Date: 2006-09-15 04:32:01
Junio C Hamano <> writes:

> Jakub Narebski <> writes:
>> Not true. Link to directory is both -d $_ and -l $_, so
>> 	return unless (-d $_ || (-l $_ && -d readlink($_)));
>> is not needed.
> I think you mis-read what I said.  I first wondered why you did
> not say "return unless -d _" and wrote (seemingly more
> inefficient) "return unless -d $_".  The comment is to clarify
> why '$' is needed.
> In other words, after this setup:
>         $ rm -fr d dl
>         $ mkdir d
>         $ ln -s d dl
> you do not see an output from this:
>         $ perl -e 'lstat "dl"; print "is-dir\n" if -d _;'
> but you do from this:
>         $ perl -e 'lstat "dl"; print "is-dir\n" if -d "dl";'

Side note:


	return unless -d $_

there is definitely more correct than "return unless -d _" which
is not, it is not the most efficient.  Because you use fast_xxx,
you know the last stat was lstat so "-d _" would be true if the
thing you are looking at is a real directory and will be a
zero-cost operation.  The only case you want to be careful is a
symlink pointing at a directory, so

	return unless ((-d _) || (-l _ && -d $_))

would be more efficient.

I have a strange suspicion that Merlyn will soon join us with
more expertise if we keep talking about Perl ;-)

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at
Received on Fri Sep 15 04:32:03 2006

This archive was generated by hypermail 2.1.8 : 2006-09-15 04:32:45 EST