Re: [PATCH v4] git-new-workdir: Don't fail if the target directory is empty
- From
Paul Smith <paul@mad-scientist.net>
- Date
- Nov 28, 2014, 18:34 UTC
- Message-ID
- <1417199645.3562.6.camel@homebase>
- In-Reply-To
- <xmqqk32ho8mc.fsf@gitster.dls.corp.google.com>
On Wed, 2014-11-26 at 15:16 -0800, Junio C Hamano wrote:
Show 5 quoted lines
> > $ ./src/git/contrib/workdir/git-new-workdir src/git foo master > > mkdir: cannot create directory ‘foo’: Not a directory > > unable to create new workdir "foo"! > > ;-) That comes from mkdir || fail which is indeed sufficient.
Right. Often I find it simpler/clearer to let the underlying commands give the errors: they use perror() and can often provide more specific error messages than my script can, unless I spend a lot of effort trying to determine exactly what the problem is (permissions, disk space, bad symlink, existing file, whatever).
Should I respin this with the \"$new_workdir\" -> '$new_workdir' change (I actually prefer the latter myself but the former was used somewhere so I kept it)?