git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Emily Shaffer <emilyshaffer@google.com>
To: Jeff King <peff@peff.net>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"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 13:45:00 -0700	[thread overview]
Message-ID: <20191024204500.GG9323@google.com> (raw)
In-Reply-To: <20191024181344.GD12892@sigill.intra.peff.net>

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@gitster.mtv.corp.google.com/
> 
> 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

  reply	other threads:[~2019-10-24 20:45 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
2019-10-24 20:45     ` Emily Shaffer [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191024204500.GG9323@google.com \
    --to=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=mirucam@gmail.com \
    --cc=peff@peff.net \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).