diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2019-12-30 18:42:36 +0000 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2019-12-30 19:30:33 +0000 |
commit | 422e7bc31d7d3818e1f8a50cfec0713258fb9f29 (patch) | |
tree | 3159d05f7cf3cd0a177f66441ea93978ade8c6ba | |
parent | 57cef6c60022b7e2b8876ff30bfe49bdf1c5be18 (diff) | |
download | dotfiles-422e7bc31d7d3818e1f8a50cfec0713258fb9f29.tar.gz |
avoid clobbering annex.used-refspec git config
-rw-r--r-- | lib/perl5/Local/MrRepo/Repo/Git/Annex.pm | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm index f72e8783..56c9e7ac 100644 --- a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm +++ b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm @@ -73,11 +73,21 @@ sub review { sub review_unused { my $self = shift; my %opts = @_; - $opts{interactive} //= 0; - $opts{used_refspec} //= "+refs/heads/*:-refs/heads/synced/*"; - my %unused_args = (used_refspec => $opts{used_refspec}); - my %dropunused_args = (force => 1); + my $used_refspec_config; + try { ($used_refspec_config) = $self->git->config("annex.used-refspec") }; + + $opts{interactive} //= 0; + # only supply a default value for this if annex.used-refspec has + # not been configured, so that annex.used-refspec takes effect if + # our caller does not supply a used_refspec + $opts{used_refspec} //= "+refs/heads/*:-refs/heads/synced/*" + unless defined $used_refspec_config; + + my %unused_args = (); + $unused_args{used_refspec} = $opts{used_refspec} + if exists $opts{used_refspec}; + my %dropunused_args = (force => 1); $unused_args{from} = $dropunused_args{from} = $opts{from} if defined $opts{from}; |