]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-archimport.perl
git-svn: hopefully make 'fetch' more user-friendly
[git.git] / git-archimport.perl
index ada60ec240a8b3eb4ef6efea6b6223fc8523705f..66aaeae1021eb3c791815f927e95a87e7afa557c 100755 (executable)
@@ -95,6 +95,15 @@ $ENV{'TMPDIR'} = $opt_t if $opt_t; # $ENV{TMPDIR} will affect tempdir() calls:
 my $tmp = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 $opt_v && print "+ Using $tmp as temporary directory\n";
 
+unless (-d $git_dir) { # initial import needs empty directory
+    opendir DIR, '.' or die "Unable to open current directory: $!\n";
+    while (my $entry = readdir DIR) {
+        $entry =~ /^\.\.?$/ or
+            die "Initial import needs an empty current working directory.\n"
+    }
+    closedir DIR
+}
+
 my %reachable = ();             # Arch repositories we can access
 my %unreachable = ();           # Arch repositories we can't access :<
 my @psets  = ();                # the collection
@@ -226,7 +235,7 @@ my $import = 0;
 unless (-d $git_dir) { # initial import
     if ($psets[0]{type} eq 'i' || $psets[0]{type} eq 't') {
         print "Starting import from $psets[0]{id}\n";
-       `git-init-db`;
+       `git-init`;
        die $! if $?;
        $import = 1;
     } else {