From: Ian Jackson Date: Wed, 2 Aug 2017 14:09:12 +0000 (+0100) Subject: playground refactoring: Dgit.pm: Expose $local_git_cfg X-Git-Tag: archive/debian/4.1~39 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=d99fbfc09e25cda5a7e95c3c632436d22cb4e59a;hp=3c79424dd5982b8bea141a14e1909a972de0f2cc 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 --- diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 19776662..515a32f6 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;