chiark / gitweb /
clone: Check for git earlier
[dgit.git] / dgit
diff --git a/dgit b/dgit
index af710657502fc822ac6a04e64e68329941890840..4c8a09dadfa9e43f44c5f8556864874a0e15adc0 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -664,7 +664,9 @@ sub access_runeinfo ($) {
 
 sub access_someuserhost ($) {
     my ($some) = @_;
-    my $user = access_cfg("$some-user",'username');
+    my $user = access_cfg("$some-user-force", 'RETURN-UNDEF');
+    defined($user) && length($user) or
+       $user = access_cfg("$some-user",'username');
     my $host = access_cfg("$some-host");
     return length($user) ? "$user\@$host" : $host;
 }
@@ -1375,6 +1377,7 @@ sub clone ($) {
     my ($dstdir) = @_;
     canonicalise_suite();
     badusage "dry run makes no sense with clone" unless act_local();
+    my $hasgit = check_for_git();
     mkdir $dstdir or die "$dstdir $!";
     changedir $dstdir;
     runcmd @git, qw(init -q);
@@ -1386,7 +1389,7 @@ sub clone ($) {
        close H or die $!;
        runcmd @git, qw(remote add), 'origin', $giturl;
     }
-    if (check_for_git()) {
+    if ($hasgit) {
        progress "fetching existing git history";
        git_fetch_us();
        runcmd_ordryrun_local @git, qw(fetch origin);