]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-cvsimport.perl
GIT 1.5.4-rc2
[git.git] / git-cvsimport.perl
index d29b547d2670eb1a3c4d3290ab10939cf652497a..6d8ff93f5f7bf05f2e94b4e1c522423c8430739c 100755 (executable)
@@ -108,10 +108,6 @@ sub read_repo_config {
             }
                }
        }
-    if (@ARGV == 0) {
-        chomp(my $module = `git-repo-config --get cvsimport.module`);
-        push(@ARGV, $module);
-    }
 }
 
 my $opts = "haivmkuo:d:p:r:C:z:s:M:P:A:S:L:";
@@ -119,6 +115,10 @@ read_repo_config($opts);
 getopts($opts) or usage();
 usage if $opt_h;
 
+if (@ARGV == 0) {
+               chomp(my $module = `git-repo-config --get cvsimport.module`);
+               push(@ARGV, $module) if $? == 0;
+}
 @ARGV <= 1 or usage("You can't specify more than one CVS module");
 
 if ($opt_d) {
@@ -223,7 +223,8 @@ sub conn {
                        }
                }
 
-               $user="anonymous" unless defined $user;
+               # if username is not explicit in CVSROOT, then use current user, as cvs would
+               $user=(getlogin() || $ENV{'LOGNAME'} || $ENV{'USER'} || "anonymous") unless $user;
                my $rr2 = "-";
                unless ($port) {
                        $rr2 = ":pserver:$user\@$serv:$repo";
@@ -631,6 +632,7 @@ unless ($opt_P) {
            print $cvspsfh $_;
        }
        close CVSPS;
+       $? == 0 or die "git-cvsimport: fatal: cvsps reported error\n";
        close $cvspsfh;
 } else {
        $cvspsfile = $opt_P;
@@ -847,7 +849,7 @@ while (<CVS>) {
                }
                if (!$opt_a && $starttime - 300 - (defined $opt_z ? $opt_z : 300) <= $date) {
                        # skip if the commit is too recent
-                       # that the cvsps default fuzz is 300s, we give ourselves another
+                       # given that the cvsps default fuzz is 300s, we give ourselves another
                        # 300s just in case -- this also prevents skipping commits
                        # due to server clock drift
                        print "skip patchset $patchset: $date too recent\n" if $opt_v;