git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Outreachy][PATCH] abspath: reconcile `dir_exists()` and `is_directory()`

From
Miriam R. <mirucam@gmail.com>
Date
Oct 25, 2019, 08:59 UTC
Message-ID
<CAN7CjDB9mRTNRKRoE8XfLz4in5gV6pxrKrqcjLPfthDHaf20nA@mail.gmail.com>
In-Reply-To
<xmqqmudpee57.fsf@gitster-ct.c.googlers.com>
Ok, then after discussion, finally the issue tasks would be:
- Add path_exists() that will work same as file_exists(), keeping for
now the latter.
- Use path_exists() instead of dir_exists() in builtin/clone.c.
And also:
- Rename is_directory() to dir_exists(), as it is the equivalent to
path_exists()/file_exists(), isn't it?

Best, Miriam

El vie., 25 oct. 2019 a las 4:46, Junio C Hamano (<gitster@pobox.com>) escribió:
Show 17 quoted lines
>
> 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-<.
>
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 15 in “abspath: reconcile `dir_exists()` and `is_directory()`”
  1. Miriam RubioOct 24, 2019
  2. SZEDER GáborOct 24, 2019
  3. Jeff KingOct 24, 2019
  4. Emily ShafferOct 24, 2019
  5. Jeff KingOct 24, 2019
  6. Junio C HamanoOct 25, 2019
  7. Miriam R.Oct 24, 2019
  8. Junio C HamanoOct 25, 2019
  9. Miriam R.Oct 25, 2019
  10. Junio C HamanoOct 25, 2019
  11. Christian CouderOct 25, 2019
  12. Miriam R.Oct 25, 2019
  13. Miriam R.Oct 26, 2019
  14. Christian CouderOct 26, 2019
  15. Miriam R.Oct 26, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.