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

Re: [Outreachy] [PATCH] clone: rename static function `dir_exists()`.

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 29, 2019, 03:03 UTC
Message-ID
<xmqqimo86yon.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191028165523.84333-1-mirucam@gmail.com>
Miriam Rubio <mirucam@gmail.com> writes:
Show 13 quoted lines
> builtin/clone.c has a static function dir_exists() that
> checks if a given path exists on the filesystem.  It returns
> true (and it is correct for it to return true) when the
> given path exists as a non-directory (e.g. a regular file).
>
> This is confusing.  What the caller wants to check, and what
> this function wants to return, is if the path exists, so
> rename it to path_exists().
>
> Signed-off-by: Miriam Rubio <mirucam@gmail.com>
> ---
>  builtin/clone.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

With a narrowed scope, the patch and its explanation are both perfect ;-)

Now, with this localized change behind us, we may want to consider what to do with file_exists(path) that does not ensure the path is a file. It would be a separate topic, and it is OK for the result after such consideration to be "let's not go further for now". It also is OK for it to be "I am interested in digging further", too.

Thanks.  Will queue.
Previous: Miriam RubioNext: Miriam R.
Message 2 of 3 in “clone: rename static function `dir_exists()`.”
  1. Miriam RubioOct 28, 2019
  2. Junio C HamanoOct 29, 2019
  3. Miriam R.Oct 29, 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.