From: Jeff King <peff@peff.net>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Miriam Rubio <mirucam@gmail.com>, git@vger.kernel.org
Subject: Re: [Outreachy][PATCH] abspath: reconcile `dir_exists()` and `is_directory()`
Date: Thu, 24 Oct 2019 14:13:45 -0400 [thread overview]
Message-ID: <20191024181344.GD12892@sigill.intra.peff.net> (raw)
In-Reply-To: <20191024114148.GK4348@szeder.dev>
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@gitster.mtv.corp.google.com/
and its subthread.
-Peff
next prev parent reply other threads:[~2019-10-24 18:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 9:27 [Outreachy][PATCH] abspath: reconcile `dir_exists()` and `is_directory()` Miriam Rubio
2019-10-24 11:41 ` SZEDER Gábor
2019-10-24 18:13 ` Jeff King [this message]
2019-10-24 20:45 ` Emily Shaffer
2019-10-24 20:51 ` Jeff King
2019-10-25 2:40 ` Junio C Hamano
2019-10-24 20:57 ` Miriam R.
2019-10-25 2:45 ` Junio C Hamano
2019-10-25 8:59 ` Miriam R.
2019-10-25 9:43 ` Junio C Hamano
2019-10-25 14:47 ` Christian Couder
2019-10-25 15:23 ` Miriam R.
2019-10-26 15:30 ` Miriam R.
2019-10-26 18:05 ` Christian Couder
2019-10-26 18:42 ` Miriam R.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191024181344.GD12892@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mirucam@gmail.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).