Skip to contentSkip to conversation

cvs export: ensure we add directories in order

PATCH New Alex Bennee 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cvs export: ensure we add directories in order

Hi,

CVS gets understandably upset if you try and add a subdirectory before it's parent directory. This patch fixes that.

Quoted 1 line

From d99d4e7eb0ce7b85fb84d3c57f57abbb100baa5e Mon Sep 17 00:00:00 2001

From: Alex Bennee <[email protected]>
Date: Thu, 18 Oct 2007 17:12:13 +0100
Subject: [PATCH] Ensure we add directories in the correct order

---
 git-cvsexportcommit.perl |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
git-cvsexportcommit.perl +11 -0
index 0a21215..a70c583 100755
@@ -234,6 +234,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;
Signature · 8 lines
1.5.2.5



-- 
Alex, homepage: http://www.bennee.com/~alex/
Business is a good game -- lots of competition and minimum of rules. You
keep score with money. -- Nolan Bushnell, founder of Atari