From a0305ec029c93474f7c4cb09d27b25e1ba2dd428 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sat, 10 Mar 2012 13:56:02 +0530 Subject: [PATCH] sugar 'option'; see below option foo = bar -> config gitolite-options.foo = bar --- src/Gitolite/Conf/Sugar.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Gitolite/Conf/Sugar.pm b/src/Gitolite/Conf/Sugar.pm index 932928d..881cbcf 100644 --- a/src/Gitolite/Conf/Sugar.pm +++ b/src/Gitolite/Conf/Sugar.pm @@ -45,12 +45,30 @@ sub sugar { # then our stuff: + $lines = option($lines); $lines = owner_desc($lines); # $lines = name_vref($lines); return $lines; } +sub option { + my $lines = shift; + my @ret; + + # option foo = bar + # -> config gitolite-options.foo = bar + + for my $line (@$lines) { + if ( $line =~ /^option (\S+) = (\S.*)/ ) { + push @ret, "config gitolite-options.$1 = $2"; + } else { + push @ret, $line; + } + } + return \@ret; +} + sub owner_desc { my $lines = shift; my @ret;