public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Paul Smith <paul@mad-scientist•net>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] git-new-workdir: Don't fail if the target directory is empty
Date: Tue, 18 Nov 2014 11:32:38 -0800	[thread overview]
Message-ID: <xmqq8uj8wbhl.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <s934mtwo0zv.fsf@mad-scientist.net> (Paul Smith's message of "Tue, 18 Nov 2014 12:46:28 -0500")

Paul Smith <paul@mad-scientist•net> 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).

  reply	other threads:[~2014-11-18 19:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 17:49 [PATCH] git-new-workdir: Don't fail if the target directory is empty Paul Smith
2014-11-17 17:22 ` Junio C Hamano
2014-11-18 17:46   ` Paul Smith
2014-11-18 19:32     ` Junio C Hamano [this message]
2014-11-18 20:54       ` Paul Smith
2014-11-18 20:58         ` Junio C Hamano
2014-11-18 22:25           ` Paul Smith
2014-11-18 22:51             ` Junio C Hamano
2014-11-19  0:57               ` Paul Smith
  -- strict thread matches above, loose matches on Subject: below --
2014-11-18 19:36 Paul Smith
2014-11-18 20:15 ` Junio C Hamano
2014-11-19 17:32 ` Junio C Hamano
2014-11-20 15:41   ` Paul Smith
2014-11-20 15:46 Paul Smith
2014-11-20 17:13 ` Junio C Hamano
2014-11-21 15:08   ` Paul Smith
2014-11-21 17:33     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq8uj8wbhl.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=paul@mad-scientist$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox