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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>) escribió:
>
> SZEDER Gábor <szeder.dev@xxxxxxxxx> 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-<.
>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux