Git::Annex(3pm)

πŸ“¦
version 0.008 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– 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, run git log --stat -S on 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 --from option to git annex unused.
  • used_refspec β€” corresponds to the --used-refspec option to git annex unused.
defaults to the annex.used-refspec git 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. πŸ‘‘


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