diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2014-10-29 21:54:34 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2014-11-08 16:16:57 +0000 |
commit | cd8d74f752554d8fdb896712225b63d9877a3c09 (patch) | |
tree | 3d734f334c79631551656a2e20927cb7fe4e6744 /dgit | |
parent | 010a0e1ee137b4fc4d6e5cbfbc5551df8835ce7e (diff) |
Make access_giturl be capable of being optional, and use this feature when cloning (for the benefit of distros with no dgit-repos)
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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(); |