From: Sean Date: Sat, 07 May 2005 00:32:42 GMT Subject: Re: [PATCH] Introduce SHA1_FILE_DIRECTORIES Message-ID: <2721.10.10.10.24.1115425962.squirrel@linux1> In-Reply-To: <7vis1vc27f.fsf@assigned-by-dhcp.cox.net> On Fri, May 6, 2005 8:24 pm, Junio C Hamano said: >>>>>> "S" == Sean writes: > > S> has_sha1_file can be reduced to: > > S> int has_sha1_file(const unsigned char *sha1) > S> { > S> return (!!find_sha1_file(sha1)); > S> } > > Not really. If you do not have alternates it does not even > bother to stat so you get the path that supposed to contain the > data and you need to do the checking yourself. > > Perhaps I'm just missing something in your code, but this fragment makes it look to me that stat is always called in find_sha1_file even when there are no alternates: + char *name = sha1_file_name(sha1); [...] + if (!stat(name, &st)) + return name; + for (i = 0; i < num_alt; i++) { Sean