Re: [TRYTHIS] cvsimport: fix initial import

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, 27 Jun 2006, Martin Langhoff wrote:

> 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".
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]