Git::Annex(3pm)
π Git::Annex π
okay so bestie, this is the Perl interface to git-annex repositories, and it's version 0.008. we're in Git::Annex(3pm) territory, and honestly? it's giving "your fave repo wrapper but make it elegant." π
β¨ SYNOPSIS β¨
my $annex = Git::Annex->new("/home/spwhitton/annex");
# run `git annex unused` and then `git log` to get information about
# unused git annex keys
my $unused_files
= $self->unused(used_refspec => "+refs/heads/master", log => 1);
for my $unused_file (@$unused_files) {
say "unused file " . $unused_file->{key} . ":";
say "";
say " $_" for $unused_file->{log_lines};
say "";
say "you can drop it with: `git annex dropunused "
. $unused_file->{number} . "`";
say "";
}
# embedded Git::Wrapper instance with shortcut to access annex subcommands
say for $annex->annex->find(qw(--not --in here));
$annex->annex->copy(qw(-t cloud --in here --and --lackingcopies=1));
πΈ DESCRIPTION πΈ
so a Git::Annex object is literally just a little representation of a git repository where git annex init has already been run, periodt. this module hands you some genuinely useful methods for working with those repos from Perl. if you wanna know more about git-annex itself, the vibe is at https://git-annex.branchable.com/ β go look, iykyk. π¦
π ATTRIBUTES π
π toplevel
the root of the repository. that's it, that's the whole thing. π
π git
an instance of Git::Wrapper that's been initialised in the repository.
π annex
gives you access to git-annex subcommands in exactly the same way that Git::Annex::git gives you access to git subcommands. so like:
$self->git->annex("contentlocation", $key);
may also be written as:
$self->annex->contentlocation($key);
no cap, that's the whole flex. β¨
π METHODS π
π new($dir)
instantiate an object representing a git-annex located in $dir. easy peasy, bestie. π«Ά
π unused(%opts)
runs git annex unused and hands back a hashref stuffed with info on unused files.
here's the iconic part: the info gets cached inside the .git/annex directory. which means a user can keep running your script without repeatedly executing expensive git annex and git log commands. obsessed. π
optional arguments, babes:
logβ if true, rungit log --stat -Son each unused file, so you can see what filenames the unused data had if and when it was used data in the annex.
defaults to false, BUT if there's already log data sitting in the cache, it will always be returned. the cache said what it said. π
fromβ corresponds to the--fromoption togit annex unused.used_refspecβ corresponds to the--used-refspecoption togit annex unused.
defaults to theannex.used-refspecgit config key if it's set, otherwise"+refs/heads/*:-refs/heads/synced/*". β¨
π abs_contentlocation($key)
returns an absolute path to the content for git-annex key $key. π
π batch($cmd, @args)
instantiate a Git::Annex::BatchCommand object by starting up a git-annex --batch command.
my $batch = $annex->batch("find", "--in=here");
say "foo/bar annexed content is present in this repo"
if $batch->say("foo/bar");
# kill the batch process:
undef $batch;
heads up β the way you shut this thing down is by undef-ing it. that kills the batch process. do not forget, bestie. π
π AUTHOR π
Sean Whitton <spwhitton@spwhitton.name> β king behavior, honestly. π
πΈ COPYRIGHT AND LICENSE πΈ
This software is Copyright (c) 2019-2021 by Sean Whitton <spwhitton@spwhitton.name>.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
and that's a wrap, bestie! π this page came to you courtesy of perl v5.40.1 and the date 2025-03-04 β slay, and remember: read the docs before you dropunused anything. πβ¨π¦
π¦ where this page comes from
- debian trixie: libgit-annex-perl 0.008-2 Β· GPL-3.0-or-later
- ubuntu resolute: libgit-annex-perl 0.008-2 Β· GPL-3.0-or-later
- ubuntu stonking: libgit-annex-perl 0.008-2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms