From: Alex Bennee Date: Thu, 18 Oct 2007 16:15:44 +0000 (+0100) Subject: Ensure we add directories in the correct order X-Git-Tag: v1.5.3.5~31 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fd0b9594d0c2bb50469bfc1481ea4395b7a76548;p=git.git Ensure we add directories in the correct order CVS gets understandably upset if you try and add a subdirectory before it's parent directory. This patch fixes that. Signed-off-by: Shawn O. Pearce --- diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index a33fa8d4c..7b19a33ad 100755 --- a/git-cvsexportcommit.perl +++ b/git-cvsexportcommit.perl @@ -224,6 +224,17 @@ print "Applying\n"; print "Patch applied successfully. Adding new files and directories to CVS\n"; my $dirtypatch = 0; + +# +# We have to add the directories in order otherwise we will have +# problems when we try and add the sub-directory of a directory we +# have not added yet. +# +# Luckily this is easy to deal with by sorting the directories and +# dealing with the shortest ones first. +# +@dirs = sort { length $a <=> length $b} @dirs; + foreach my $d (@dirs) { if (system(@cvs,'add',$d)) { $dirtypatch = 1;