From: Ian Jackson Date: Wed, 29 Oct 2014 21:54:34 +0000 (+0000) Subject: Make access_giturl be capable of being optional, and use this feature when cloning... X-Git-Tag: debian/0.30~311 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=cd8d74f752554d8fdb896712225b63d9877a3c09 Make access_giturl be capable of being optional, and use this feature when cloning (for the benefit of distros with no dgit-repos) --- diff --git a/dgit b/dgit index 25afa673..fa09ca35 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();