summaryrefslogtreecommitdiff
path: root/perl5
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-06-12 14:10:17 +0100
committerSean Whitton <spwhitton@spwhitton.name>2023-06-13 13:54:14 +0100
commitda6eea669029d1fa761f5e091f490278de7ac803 (patch)
treebb0f19845d570742127aa4c5364c3a8f7b7edfe3 /perl5
parenta1909031f69be27e34ae46fcb72c1bcc14bc4a11 (diff)
downloaddotfiles-da6eea669029d1fa761f5e091f490278de7ac803.tar.gz
when reviewing some annexes, move unused files from external drives
Diffstat (limited to 'perl5')
-rw-r--r--perl5/Local/MrRepo/Repo/Git/Annex.pm23
1 files changed, 21 insertions, 2 deletions
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 {