Re: [PATCH] git-new-workdir: Don't fail if the target directory is empty

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

 



Paul Smith <paul@xxxxxxxxxxxxxxxxx> writes:

>>> +	if test $(ls -a1 "$new_workdir/." | wc -l) -ne 2
>
>> I wonder if this check is portable for all platforms we care about,
>> but that is OK, as it should be so for the ones I think of and care
>> about ;-)
>
> Do you mean "." and ".." representing an empty directory?  That will
> work on any system where /bin/sh works, for sure.

Even on network mounts from esoteric filesystems and such?  When

    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html

mentions the "-A" option, it says:

    -A
        Write out all directory entries, including those whose names
        begin with a <period> ( '.' ) but excluding the entries dot
        and dot-dot (if they exist).

The "if they exist" part suggests, at least to me, that it is valid
for a POSIX filesystem to lack these two (I suspect that one may be
able to find a more definitive answer from other parts of the POSIX
but I didn't bother).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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