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

[PATCH] make git-cvsimport work on ref-packed repositories

From
SSStephan Springl <springl-git@bfw-online.de>
Date
May 23, 2007, 07:13 UTC
Message-ID
<Pine.LNX.4.64.0705230909310.25524@lar.bfw.de>
Hi!
      This helps us to use git-cvsimport on our ref-packed repositories.
Maybe you want to use this or a similar solution to be integrated in
stock git.
Thank you.
Stephan.
commit 83f8922f1ad385ef3493684838e11a34edbf68a7
Author: Stephan Springl <springl-git@bfw-online.de>
Date:   Wed May 23 09:06:37 2007 +0200
     Use git-for-each-ref to check whether the origin (or opt_o) branch exists.
     This works in repositories that have their refs packed by
     "git-pack-refs --all --prune" whereas testing the file
     $git_dir/refs/heads/$opt_o does not.
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index ac74bc5..f68afe7 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -559,11 +559,6 @@ unless (-d $git_dir) {
  	$last_branch = $opt_o;
  	$orig_branch = "";
  } else {
-	-f "$git_dir/refs/heads/$opt_o"
-		or die "Branch '$opt_o' does not exist.\n".
-		       "Either use the correct '-o branch' option,\n".
-		       "or import to a new repository.\n";
-
  	open(F, "git-symbolic-ref HEAD |") or
  		die "Cannot run git-symbolic-ref: $!\n";
  	chomp ($last_branch = <F>);
@@ -588,6 +583,11 @@ unless (-d $git_dir) {
  		$branch_date{$head} = $1;
  	}
  	close(H);
+        if (!exists $branch_date{$opt_o}) {
+		die "Branch '$opt_o' does not exist.\n".
+		       "Either use the correct '-o branch' option,\n".
+		       "or import to a new repository.\n";
+        }
  }

  -d $git_dir


--
Stephan Springl                           BFW Werner Völk GmbH
springl-git@bfw-online.de                 Energiemesstechnik & Service
+49 89 82917-452                          Drosselgasse 5
                                           82166 Gräfelfing/München
Next: Johannes Schindelin
Message 1 of 4 in “make git-cvsimport work on ref-packed repositories”
  1. make git-cvsimport work on ref-packed repositoriesStephan Springl, May 23, 2007
  2. Use git-for-each-ref to check whether the origin branch exists.Johannes Schindelin, May 23, 2007
  3. Stephan SpringlMay 23, 2007
  4. Junio C HamanoMay 23, 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.