diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-06-12 14:10:17 +0100 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-06-13 13:54:14 +0100 |
commit | da6eea669029d1fa761f5e091f490278de7ac803 (patch) | |
tree | bb0f19845d570742127aa4c5364c3a8f7b7edfe3 | |
parent | a1909031f69be27e34ae46fcb72c1bcc14bc4a11 (diff) | |
download | dotfiles-da6eea669029d1fa761f5e091f490278de7ac803.tar.gz |
when reviewing some annexes, move unused files from external drives
-rw-r--r-- | lib-src/git/annex | 3 | ||||
-rw-r--r-- | lib-src/git/lib/annex | 3 | ||||
-rw-r--r-- | lib-src/git/lib/wikiannex | 3 | ||||
-rw-r--r-- | lib-src/git/src/athpriv | 1 | ||||
-rw-r--r-- | perl5/Local/MrRepo/Repo/Git/Annex.pm | 23 |
5 files changed, 31 insertions, 2 deletions
diff --git a/lib-src/git/annex b/lib-src/git/annex index cc124d51..d5ce3f39 100644 --- a/lib-src/git/annex +++ b/lib-src/git/annex @@ -12,5 +12,8 @@ [remote "origin"] annex-ignore = true +[spwhitton "mrrepo"] + move-extdrive-unused = true + [spwhitton "unpushed-tags"] ignore = true diff --git a/lib-src/git/lib/annex b/lib-src/git/lib/annex index 12782cd3..a26012cd 100644 --- a/lib-src/git/lib/annex +++ b/lib-src/git/lib/annex @@ -12,5 +12,8 @@ [remote "origin"] annex-ignore = true +[spwhitton "mrrepo"] + move-extdrive-unused = true + [spwhitton "unpushed-tags"] ignore = true diff --git a/lib-src/git/lib/wikiannex b/lib-src/git/lib/wikiannex index a740a2f3..61143d19 100644 --- a/lib-src/git/lib/wikiannex +++ b/lib-src/git/lib/wikiannex @@ -3,5 +3,8 @@ [remote "origin"] annex-ignore = true +[spwhitton "mrrepo"] + move-extdrive-unused = true + [spwhitton "unpushed-tags"] ignore = true diff --git a/lib-src/git/src/athpriv b/lib-src/git/src/athpriv index 74d0327e..ee577648 100644 --- a/lib-src/git/src/athpriv +++ b/lib-src/git/src/athpriv @@ -10,6 +10,7 @@ [spwhitton "mrrepo"] review-unused = false + move-extdrive-unused = true [remote "origin"] annex-ignore = true diff --git a/perl5/Local/MrRepo/Repo/Git/Annex.pm b/perl5/Local/MrRepo/Repo/Git/Annex.pm index 7b037f8c..862397f8 100644 --- a/perl5/Local/MrRepo/Repo/Git/Annex.pm +++ b/perl5/Local/MrRepo/Repo/Git/Annex.pm @@ -1,6 +1,6 @@ package Local::MrRepo::Repo::Git::Annex; -# Copyright (C) 2019-2020 Sean Whitton +# Copyright (C) 2019-2020, 2023 Sean Whitton # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -64,7 +64,26 @@ sub review { (" configured to run that command with the right remotes)"); $issues = 1; } - # 2. Check for unused files which we should be able to clean up + # 2. Pull in unused files on external drives before we review. + # This reduces the number of times we might have to review these + # particular unused files. + if ($self->config_bool("spwhitton.mrrepo.move-extdrive-unused", "false")) + { + foreach my $remote ($self->git->remote) { + my ($url) = $self->git->remote("get-url", $remote); + $url =~ m#\A/media/# and -d $url or next; + $self->git->annex( + "unused", + { + used_refspec => "+refs/heads/*:-refs/heads/synced/*", + from => $remote + }); + system qw(git -C), $self->toplevel, + qw(annex move --unused --numcopies=1), "--from=$remote"; + # TODO Empty .git/annex/tmp/ on the external drive? + } + } + # 3. Check for unused files which we should be able to clean up if ($self->config_bool("spwhitton.mrrepo.review-unused", "true")) { #<<< try { |