Re: [Outreachy][PATCH] abspath: reconcile `dir_exists()` and `is_directory()`
- From
Jeff King <peff@peff.net>
- Date
- Oct 24, 2019, 20:51 UTC
- Message-ID
- <20191024205100.GB30715@sigill.intra.peff.net>
- In-Reply-To
- <20191024204500.GG9323@google.com>
On Thu, Oct 24, 2019 at 01:45:00PM -0700, Emily Shaffer wrote:
Show 12 quoted lines
> > 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 :)
Yeah, I think one path forward could be:
- add path_exists(); this will work the same as file_exists(), but is
a better name. Keep file_exists() for now, but put a comment that
new calls should use path_exists(). - use path_exists() in builtin/clone.c, ditching its custom
dir_exists() - (optional) start converting file_exists() calls to path_exists(),
after confirming what each call wants (just files, or any path) I one really does want to check for a regular file, then we'd need
to figure out what the "does this regular file exist" function is
called. I have a suspicion that there won't be any such callers, so
we can punt on it until then.-Peff