diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-23 17:03:24 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-23 17:03:24 -0700 |
commit | 35095f9b59c7e4b7585c01e66fba1b7d0a87e950 (patch) | |
tree | d412ea006279da7fd82318e2274aa97e3b6620a3 | |
parent | 0af20403e80fe271cc5069308f6e1d36406decdc (diff) | |
parent | e5d36bfcae4b6d52747ea7815a08ed8392bcd07c (diff) | |
download | p5-Git-Annex-35095f9b59c7e4b7585c01e66fba1b7d0a87e950.tar.gz |
Merge tag 'v0.006' into debian
v0.006
# gpg: Signature made Mon 23 Mar 2020 05:03:11 PM MST
# gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240
# gpg: issuer "spwhitton@spwhitton.name"
# gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate]
# Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B
# Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | dist.ini | 2 | ||||
-rw-r--r-- | lib/App/annex_review_unused.pm | 48 |
3 files changed, 30 insertions, 24 deletions
@@ -2,6 +2,10 @@ Revision history for Git::Annex {{$NEXT}} +0.006 2020-03-23 17:02:28-07:00 America/Phoenix + - annex-review-unused: Check whether unused files still exist earlier. + Avoids misleading output when --just-print is supplied. + 0.005 2020-03-23 11:55:48-07:00 America/Phoenix - annex-review-unused: Add missing prompt_yn subroutine. - annex-review-unused: Always pass --force to 'git annex dropunused'. @@ -4,7 +4,7 @@ license = GPL_3 copyright_holder = Sean Whitton <spwhitton@spwhitton.name> copyright_year = 2019-2020 -version = 0.005 +version = 0.006 [PkgVersion] [PodWeaver] diff --git a/lib/App/annex_review_unused.pm b/lib/App/annex_review_unused.pm index eae6cd0..dd2ed23 100644 --- a/lib/App/annex_review_unused.pm +++ b/lib/App/annex_review_unused.pm @@ -67,7 +67,28 @@ sub main { $unused_opts{used_refspec} = $used_refspec_arg if $used_refspec_arg; my @to_drop; - my @unused_files = @{ $annex->unused(%unused_opts, log => 1) }; + my @unused_files = grep { + # check the unused file still exists i.e. has not been dropped + # already (in the case of reviewing unused files at a remote, + # just check that it's not been dropped according to the local + # git-annex branch by using readpresentkey rather than + # checkpresentkey) + + my $ret = $_->{contentlocation} + = $annex->abs_contentlocation($_->{key}); + + if ($from_arg) { + #<<< + try { + $annex->annex->readpresentkey($_->{key}, $uuid); + } catch { + $ret = 0; + }; + #>>> + } + + $ret; + } $annex->unused(%unused_opts, log => 1)->@*; exit unless @unused_files; if ($just_print) { _say_spaced_bullet("There are unused files you can drop with" @@ -77,27 +98,8 @@ sub main { } my $i = 0; UNUSED: while ($i < @unused_files) { - my $unused_file = $unused_files[$i]; - - # check the unused file still exists i.e. has not been dropped - # already (in the case of reviewing unused files at a remote, just - # check that it's not been dropped according to the local - # git-annex branch by using readpresentkey rather than - # checkpresentkey) - my $contentlocation = $annex->abs_contentlocation($unused_file->{key}); - if ($from_arg) { - #<<< - try { - $annex->annex->readpresentkey($unused_file->{key}, $uuid); - } catch { - splice @unused_files, $i, 1; - next UNUSED; - }; - #>>> - } elsif (!$contentlocation) { - splice @unused_files, $i, 1; - next UNUSED; - } + my $unused_file = $unused_files[$i]; + my $contentlocation = $unused_file->{contentlocation}; system qw(clear -x) unless $just_print; _say_bold("unused file #" . $unused_file->{number} . ":"); @@ -122,7 +124,7 @@ sub main { # before prompting, clear out stdin, to avoid # registered a keypress more than once ReadMode 4; - 1 while defined ReadKey -1; + 1 while defined ReadKey(-1); my @opts = ('y', 'n'); push @opts, 'o' if $contentlocation; |