From ab4665f8b2e5361726e52b0bb042540ab13b7c48 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 14 Dec 2019 16:05:22 -0700 Subject: run all the git logs before interacting with the user --- lib/perl5/Local/MrRepo/Repo/Git/Annex.pm | 37 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm index 7268bc97..f613eabf 100644 --- a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm +++ b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm @@ -92,6 +92,25 @@ sub review_unused { say ""; } + foreach my $unused_file (@unused_files) { + # We need the RUN here to avoid special postprocessing but + # also to get the -c option passed -- unclear how to pass + # short options to git itself, not the 'log' subcommand, + # with Git::Wrapper except by using RUN (passing long + # options to git itself is easy, per Git::Wrapper docs) + @{ $unused_file->{log_lines} } = map { s/^/ /r } $self->git->RUN( + "-c", + "diff.renameLimit=3000", + "log", + { + stat => 1, + no_textconv => 1 + }, + "--color=always", + "-S", + $unused_file->{key}); + } + foreach my $unused_file (@unused_files) { system('clear', '-x') if $opts{interactive}; say_bold("unused file #" . $unused_file->{number} . ":"); @@ -119,23 +138,7 @@ sub review_unused { say " looks like stale tmp or bad file, with key " . $unused_file->{key}; } else { - # We need the RUN here to avoid special postprocessing but - # also to get the -c option passed -- unclear how to pass - # short options to git itself, not the 'log' subcommand, - # with Git::Wrapper except by using RUN (passing long - # options to git itself is easy, per Git::Wrapper docs) - my @log_lines = map { s/^/ /r } $self->git->RUN( - "-c", - "diff.renameLimit=3000", - "log", - { - stat => 1, - no_textconv => 1 - }, - "--color=always", - "-S", - $unused_file->{key}); - + my @log_lines = @{ $unused_file->{log_lines} }; if ($opts{interactive}) { # truncate log output if necessary to ensure user's # terminal does not scroll -- cgit v1.2.3