From cd8d74f752554d8fdb896712225b63d9877a3c09 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 29 Oct 2014 21:54:34 +0000 Subject: Make access_giturl be capable of being optional, and use this feature when cloning (for the benefit of distros with no dgit-repos) --- dgit | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/dgit b/dgit index 25afa67..fa09ca3 100755 --- a/dgit +++ b/dgit @@ -638,11 +638,14 @@ sub access_gituserhost () { return access_someuserhost('git'); } -sub access_giturl () { +sub access_giturl (;$) { + my ($optional) = @_; my $url = access_cfg('git-url','RETURN-UNDEF'); if (!defined $url) { + my $proto = access_cfg('git-proto', 'RETURN-UNDEF'); + return undef unless defined $proto; $url = - access_cfg('git-proto'). + $proto. access_gituserhost(). access_cfg('git-path'); } @@ -1326,11 +1329,14 @@ sub clone ($) { mkdir $dstdir or die "$dstdir $!"; changedir $dstdir; runcmd @git, qw(init -q); - runcmd @git, qw(config), "remote.$remotename.fetch", fetchspec(); - open H, "> .git/HEAD" or die $!; - print H "ref: ".lref()."\n" or die $!; - close H or die $!; - runcmd @git, qw(remote add), 'origin', access_giturl(); + my $giturl = access_giturl(1); + if (defined $giturl) { + runcmd @git, qw(config), "remote.$remotename.fetch", fetchspec(); + open H, "> .git/HEAD" or die $!; + print H "ref: ".lref()."\n" or die $!; + close H or die $!; + runcmd @git, qw(remote add), 'origin', $giturl; + } if (check_for_git()) { progress "fetching existing git history"; git_fetch_us(); -- cgit v1.2.3