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

2014-11-21 Thread Paul Smith
On Thu, 2014-11-20 at 09:13 -0800, Junio C Hamano wrote: Paul Smith p...@mad-scientist.net writes: +# don't recreate a workdir over an existing directory, unless it's empty +if test -d $new_workdir then - die destination directory '$new_workdir' already exists. + if test $(ls -a1

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

2014-11-21 Thread Junio C Hamano
Paul Smith p...@mad-scientist.net writes: Why these changes? I thought you are making sure $cleandir is absolute so that you do not have to do this and can just cd into the new working tree, the same way the user would do once it is set up. I made cleandir absolute mainly because you asked

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

2014-11-20 Thread Paul Smith
On Wed, 2014-11-19 at 09:32 -0800, Junio C Hamano wrote: Paul Smith p...@mad-scientist.net writes: I took a look at this again, and I do not agree with one design decision it makes, namely: I split the creation of the directories from the symlinks: see the new loop above. This allows us

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

2014-11-20 Thread Paul Smith
Allow new workdirs to be created in an empty directory (similar to git clone). Provide more error checking and clean up on failure. Signed-off-by: Paul Smith p...@mad-scientist.net --- contrib/workdir/git-new-workdir | 54 +++-- 1 file changed, 36

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

2014-11-20 Thread Junio C Hamano
Paul Smith p...@mad-scientist.net writes: Allow new workdirs to be created in an empty directory (similar to git clone). Provide more error checking and clean up on failure. Signed-off-by: Paul Smith p...@mad-scientist.net --- contrib/workdir/git-new-workdir | 54

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

2014-11-19 Thread Junio C Hamano
Paul Smith p...@mad-scientist.net writes: Allow new workdirs to be created in an empty directory (similar to git clone). Provide more error checking and clean up on failure. Signed-off-by: Paul Smith p...@mad-scientist.net --- Getting rid of ls/wc was not as simple as I'd hoped, due to

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

2014-11-18 Thread Paul Smith
Junio C Hamano gits...@pobox.com writes: Paul Smith p...@mad-scientist.net writes: No need to resend only to correct the above, even though there may be comments on the patch itself from me or others that may make you want to reroll this patch, in which case I'd like to see these nits gone.

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

2014-11-18 Thread Junio C Hamano
Paul Smith p...@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

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

2014-11-18 Thread Paul Smith
Allow new workdirs to be created in an empty directory (similar to git clone). Provide more error checking and clean up on failure. Signed-off-by: Paul Smith p...@mad-scientist.net --- Getting rid of ls/wc was not as simple as I'd hoped, due to glob pathname expansion (can't rely on nullglob

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

2014-11-18 Thread Junio C Hamano
Paul Smith p...@mad-scientist.net writes: Getting rid of ls/wc was not as simple as I'd hoped, I didn't say ls/wc was not portable. Assuming that a directory for which the output from ls -a has two entries is empty may be. -- To unsubscribe from this list: send the line unsubscribe git in the

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

2014-11-18 Thread Paul Smith
On Tue, 2014-11-18 at 12:15 -0800, Junio C Hamano wrote: Paul Smith p...@mad-scientist.net writes: Getting rid of ls/wc was not as simple as I'd hoped, I didn't say ls/wc was not portable. Assuming that a directory for which the output from ls -a has two entries is empty may be. Yes, I

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

2014-11-18 Thread Junio C Hamano
Paul Smith p...@mad-scientist.net writes: I can't find a clear statement that both are required and that ls -a must show them. I've used a wide range of UNIX-en and filesystems for 30 years or so and never seen one that didn't provide them. It seems like it would break quite a few scripts,

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

2014-11-18 Thread Paul Smith
On Tue, 2014-11-18 at 12:58 -0800, Junio C Hamano wrote: Doesn't the description of the -A option I quoted upthread hint a simpler and clearer solution? I.e. test $(ls -A | wc -l) = 0? Yes, but unfortunately for us the -A flag was added to POSIX Issue 7. It's not present in the previous

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

2014-11-18 Thread Junio C Hamano
OK, thanks for digging. Let's go with this version, then. On Tue, Nov 18, 2014 at 2:25 PM, Paul Smith p...@mad-scientist.net wrote: On Tue, 2014-11-18 at 12:58 -0800, Junio C Hamano wrote: Doesn't the description of the -A option I quoted upthread hint a simpler and clearer solution? I.e.

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

2014-11-18 Thread Paul Smith
On Tue, 2014-11-18 at 14:51 -0800, Junio C Hamano wrote: OK, thanks for digging. Let's go with this version, then. Thanks for your attention, Junio! -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at

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

2014-11-17 Thread Junio C Hamano
Paul Smith p...@mad-scientist.net writes: From 545c0d526eaa41f9306b567275a7d53799987482 Mon Sep 17 00:00:00 2001 From: Paul Smith p...@mad-scientist.net Date: Fri, 14 Nov 2014 17:11:19 -0500 Subject: [PATCH] git-new-workdir: Don't fail if the target directory is empty Please do not paste

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

2014-11-15 Thread Paul Smith
From 545c0d526eaa41f9306b567275a7d53799987482 Mon Sep 17 00:00:00 2001 From: Paul Smith p...@mad-scientist.net Date: Fri, 14 Nov 2014 17:11:19 -0500 Subject: [PATCH] git-new-workdir: Don't fail if the target directory is empty Also provide more error checking and clean up on failure. Signed-off