Skip to content

Commit

Permalink
Ensure we add directories in the correct order
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Bennee authored and spearce committed Oct 19, 2007
1 parent 42a3217 commit fd0b959
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions git-cvsexportcommit.perl
Expand Up @@ -224,6 +224,17 @@

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;
Expand Down

0 comments on commit fd0b959

Please sign in to comment.