diff options
author | Alex Bennee <kernel-hacker@bennee.com> | 2007-10-18 17:15:44 +0100 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-10-18 20:51:16 -0400 |
commit | fd0b9594d0c2bb50469bfc1481ea4395b7a76548 (patch) | |
tree | 7fe4d349b50f3a19617e1133fc240792ecbf428f | |
parent | 42a32174b600f139b489341b1281fb1bfa14c252 (diff) | |
download | git-fd0b9594d0c2bb50469bfc1481ea4395b7a76548.tar.gz |
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>
-rwxr-xr-x | git-cvsexportcommit.perl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index a33fa8d4c8..7b19a33ad1 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; |