git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cvs export: ensure we add directories in order

From
ABAlex Bennee <kernel-hacker@bennee.com>
Date
Oct 18, 2007, 16:15 UTC
Message-ID
<1192724144.26933.64.camel@murta.transitives.com>
Hi,

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

>From d99d4e7eb0ce7b85fb84d3c57f57abbb100baa5e Mon Sep 17 00:00:00 2001
From: Alex Bennee <alex@bennee.com>
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(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 0a21215..a70c583 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -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;
-- 
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
Message 1 of 1 in “cvs export: ensure we add directories in order”
  1. cvs export: ensure we add directories in orderAlex Bennee, Oct 18, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.