git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
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: Fri, 25 Oct 2019 11:45:56 +0900	[thread overview]
Message-ID: <xmqqmudpee57.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20191024114148.GK4348@szeder.dev> ("SZEDER =?utf-8?Q?G=C3=A1?= =?utf-8?Q?bor=22's?= message of "Thu, 24 Oct 2019 13:41:48 +0200")

SZEDER Gábor <szeder.dev@gmail.com> writes:

> The first callsite is:
>
>     dest_exists = dir_exists(dir);
>     if (dest_exists && !is_empty_dir(dir))
>             die(_("destination path '%s' already exists and is not "
>                     "an empty directory."), dir);

Yup.  The primary/original reason why the helper exists is to see if
we can create directory there, so the function is asking "is this
path taken?"  It might have been cleaner to do all of these without
using such a helper function and instead take the safer approach to
"try mkdir, and if we fail, complian", which is race-free.  But the
above is what we have now X-<.


  parent reply	other threads:[~2019-10-25  2:46 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
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 [this message]
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=xmqqmudpee57.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --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).