@matheusbsbs / matheus-bagliano / commits / fd0b9594d0
Fork 0

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 <spearce@spearce.org>

Alex Bennee committed Oct 18, 2007 at 17:15 UTC fd0b9594d0c2bb50469bfc1481ea4395b7a76548
1 file changed +11
git-cvsexportcommit.perl
+11
@@ -224,6 +224,17 @@ print "Applying\n";
224
225 print "Patch applied successfully. Adding new files and directories to CVS\n";
226 my $dirtypatch = 0;
227 +
228 +#
229 +# We have to add the directories in order otherwise we will have
230 +# problems when we try and add the sub-directory of a directory we
231 +# have not added yet.
232 +#
233 +# Luckily this is easy to deal with by sorting the directories and
234 +# dealing with the shortest ones first.
235 +#
236 +@dirs = sort { length $a <=> length $b} @dirs;
237 +
238 foreach my $d (@dirs) {
239 if (system(@cvs,'add',$d)) {
240 $dirtypatch = 1;