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

Re: [TRYTHIS] cvsimport: fix initial import

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 27, 2006, 11:01 UTC
Message-ID
<Pine.LNX.4.63.0606271259200.29667@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<46a038f90606270352w32e3888dk1557eefbe1043d92@mail.gmail.com>
Hi,
On Tue, 27 Jun 2006, Martin Langhoff wrote:
Show 6 quoted lines
> this patch doesn't quite make sense to me. The git-read-tree should be
> in the else block of the unless you have right there (and it's
> actually there, but it may be breaking in some cases? Perhaps should
> happen a bit earlier?).
> 
> How do you expect to run git-read-tree or die _before_ git-init-db?
Oops. I even do not remember what I smoked.

The git-read-tree before git-init-db evidently only works if this is not the initial import. Which it wasn't in my case.

And I keep getting confused with the "if" and "unless" sometimes prepended, sometimes appended. Well, that is Perl before Swine for me ;-)

How about this instead:
 git-cvsimport.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 50f5d96..4caef10 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -470,8 +470,6 @@ my %index; # holds filenames of one inde
 $index{$opt_o} = tmpnam();
 
 $ENV{GIT_INDEX_FILE} = $index{$opt_o};
-system("git-read-tree", $opt_o);
-die "read-tree failed: $?\n" if $?;
 
 unless(-d $git_dir) {
 	system("git-init-db");
@@ -482,6 +480,8 @@ unless(-d $git_dir) {
 	$last_branch = $opt_o;
 	$orig_branch = "";
 } else {
+	system("git-read-tree", $opt_o);
+	die "read-tree failed: $?\n" if $?;
 	-f "$git_dir/refs/heads/$opt_o"
 		or die "Branch '$opt_o' does not exist.\n".
 		       "Either use the correct '-o branch' option,\n".
Previous: Martin LanghoffNext: Martin Langhoff
Message 5 of 7 in “cvs importer woes”
  1. Andreas EricssonJun 27, 2006
  2. [TRYTHIS] cvsimport: fix initial importJohannes Schindelin, Jun 27, 2006
  3. Andreas EricssonJun 27, 2006
  4. Martin LanghoffJun 27, 2006
  5. Johannes SchindelinJun 27, 2006
  6. Martin LanghoffJun 27, 2006
  7. Andreas EricssonJun 27, 2006

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.