diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-08-02 15:09:12 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-08-03 09:56:55 +0100 |
commit | d99fbfc09e25cda5a7e95c3c632436d22cb4e59a (patch) | |
tree | 11756585372c8525e3443e2b76844afa41d0a0a3 | |
parent | 3c79424dd5982b8bea141a14e1909a972de0f2cc (diff) |
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 <ijackson@chiark.greenend.org.uk>
-rw-r--r-- | Debian/Dgit.pm | 20 |
1 files changed, 14 insertions, 6 deletions
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; |