Re: [GSoC][PATCH v4 2/4] dir: add directory_exists

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Devin Lehmacher <lehmacdj@xxxxxxxxx> writes:
>
>> +int directory_exists(const char *path)
>> +{
>> +	struct stat sb;
>> +	int ret = lstat(path, &sb);
>> +	return ret == 0 && S_ISDIR(sb.st_mode);
>> +}
>
> I am not a great fan of using file_exists() [*1*] on anything other
> than paths in the working tree (i.e. in preparation for checking
> things out of or into the index), as ...
> ...
> [Footnote]
>
> *1* ... and friends, like safe_create_leading_directories().

I actually got things mixed up.  safe-create-leading-directories is
to be used only for paths inside .git/ (i.e. not for working tree
files, but for things like ".git/refs/heads/foo" when creating a
branch called foo/bar).




[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]