diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2019-08-17 21:05:45 +0100 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2019-08-17 21:08:55 +0100 |
commit | 3ac559520eb6c4ebbc98b88a5aa37d3dd4caec30 (patch) | |
tree | 91200db0a113f39ff8ee2d8d4242dcefbe483d27 /lib | |
parent | e7e980d5d579fc2ce952a1e63a3e897288bf75fb (diff) | |
download | dotfiles-3ac559520eb6c4ebbc98b88a5aa37d3dd4caec30.tar.gz |
don't fail because can't contentlocation bad & stale tmp files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/perl5/Local/MrRepo/Repo/Git/Annex.pm | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm index a385002e..06068a5f 100644 --- a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm +++ b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm @@ -25,6 +25,7 @@ use Exporter 'import'; use Git::Wrapper; use JSON; use Local::ScriptStatus; +use Try::Tiny; our @EXPORT_OK = (); @@ -65,23 +66,35 @@ sub review { say for @unused_lines; say ""; foreach my $unused_file (@unused_files) { - my ($content_location) = - $self->git->annex("contentlocation", $unused_file->{key}); - # 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 }, - "-3", "--color=always", - "-S", $unused_file->{key}); - say_bold("unused file #" . $unused_file->{number} . ":"); - say " " . $content_location; - say ""; - say for @log_lines; + my $is_tmp_or_bad = 0; + my $content_location; + try { + ($content_location) = + $self->git->annex("contentlocation", $unused_file->{key}); + } catch { + $is_tmp_or_bad = 1; + }; + if ($is_tmp_or_bad) { + 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 }, + "-3", "--color=always", + "-S", $unused_file->{key}); + + say " " . $content_location; + say ""; + say for @log_lines; + } say ""; } $issues = 1; |