From d99fbfc09e25cda5a7e95c3c632436d22cb4e59a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 2 Aug 2017 15:09:12 +0100 Subject: playground refactoring: Dgit.pm: Expose $local_git_cfg This is now the default for playtree_setup. The caller can simply set it explicitly. We make this part of a new :playground export tag for Dgit.pm, which is going to gain other bits shortly. And, we add some comments, and move the global; more code and commentary will appear around this. Signed-off-by: Ian Jackson --- Debian/Dgit.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'Debian') diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 1977666..515a32f 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -61,8 +61,10 @@ BEGIN { changedir git_slurp_config_src playtree_setup); # implicitly uses $main::us - %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)] ); - @EXPORT_OK = @{ $EXPORT_TAGS{policyflags} }; + %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)], + playground => [qw($local_git_cfg)]); + @EXPORT_OK = ( @{ $EXPORT_TAGS{policyflags} }, + @{ $EXPORT_TAGS{playground} } ); } our @EXPORT_OK; @@ -454,9 +456,17 @@ sub git_slurp_config_src ($) { return $r; } -sub playtree_setup ($) { - # for use in the playtree +# ========== playground handling ========== + +# $local_git_cfg hash of arrays of values: git config from $maindir + +our $local_git_cfg; + +# ----- playtrees ----- + +sub playtree_setup (;$) { my ($t_local_git_cfg) = @_; + $t_local_git_cfg //= $local_git_cfg; # should be run in a directory .git/FOO/BAR of a working tree runcmd qw(git init -q); runcmd qw(git config gc.auto 0); @@ -476,6 +486,4 @@ sub playtree_setup ($) { close GA or die $!; } -our $local_git_cfg; - 1; -- cgit v1.2.3