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".