On Thu, Oct 24, 2019 at 02:13:45PM -0400, Jeff King wrote: > On Thu, Oct 24, 2019 at 01:41:48PM +0200, SZEDER Gábor wrote: > > > > diff --git a/builtin/clone.c b/builtin/clone.c > > > index c46ee29f0a..f89938bf94 100644 > > > --- a/builtin/clone.c > > > +++ b/builtin/clone.c > > > @@ -899,12 +899,6 @@ static void dissociate_from_references(void) > > > free(alternates); > > > } > > > > > > -static int dir_exists(const char *path) > > > -{ > > > - struct stat sb; > > > - return !stat(path, &sb); > > > > But look at this, it only checks that the given path exists, but it > > could be a regular file or any other kind of path other than a > > directory as well! > > > > So this function clearly doesn't do what it's name suggests. That's > > bad. > > > > Unfortunately, it gets worse: some of its callsites in > > 'builtin/clone.c' do expect it to check the existence of _any_ path, > > not just a directory. > > Yes, that's the reason for the funny name (and the fact that it was > never re-factored to use is_directory() in the first place). There's > some more discussion in: > > https://public-inbox.org/git/xmqqbmi9dw55.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx/ > > and its subthread. Hm. Then, is the solution to use dir_exists() for "a directory exists here" and also add path_exists() for "literally anything exists here"? That seems like it's still a pretty minor change. It'd be nice to un-stick our Outreachy applicant :) - Emily