]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-cvsexportcommit.perl
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
[git.git] / git-cvsexportcommit.perl
index a33fa8d4c86da54a4d741cf921d1cf7b2138d186..7b19a33ad1cceaf61793be4e16e4b144d415a975 100755 (executable)
@@ -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;