aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MGA/Git.pm
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mars-attacks.org>2013-06-24 15:22:15 +0200
committerNicolas Vigier <boklm@mars-attacks.org>2013-06-24 15:23:04 +0200
commite9e6a950e782419853b4a3b2593445eb6c85de03 (patch)
treef93ae9850ef1169074dd8b3dac58f911ee921567 /lib/MGA/Git.pm
parenta5e591ce63ad004e1a3df267f4f40337875b85c3 (diff)
downloadmgagit-e9e6a950e782419853b4a3b2593445eb6c85de03.tar
mgagit-e9e6a950e782419853b4a3b2593445eb6c85de03.tar.gz
mgagit-e9e6a950e782419853b4a3b2593445eb6c85de03.tar.bz2
mgagit-e9e6a950e782419853b4a3b2593445eb6c85de03.tar.xz
mgagit-e9e6a950e782419853b4a3b2593445eb6c85de03.zip
Allow defining repos directly in main config file
Diffstat (limited to 'lib/MGA/Git.pm')
-rw-r--r--lib/MGA/Git.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/MGA/Git.pm b/lib/MGA/Git.pm
index b964c2b..396e319 100644
--- a/lib/MGA/Git.pm
+++ b/lib/MGA/Git.pm
@@ -39,8 +39,15 @@ sub load_gitrepos_dir {
sub load_gitrepos {
my ($r) = @_;
$r->{repos} = {};
- foreach my $include (@{$config->{repos_config}}) {
- load_gitrepos_dir($r->{repos}, $include);
+ foreach my $repodef (@{$config->{repos_config}}) {
+ load_gitrepos_dir($r->{repos}, $repodef) if $repodef->{include_dir};
+ foreach my $repo ($repodef->{repos} ? @{$repodef->{repos}} : ()) {
+ my $name = "$repodef->{prefix}/$repo->{name}";
+ $r->{repos}{$name} = $repo;
+ my %infos = %$repodef;
+ delete $infos{repos};
+ @{$r->{repos}{$name}}{keys %infos} = values %infos;
+ }
}
}