DOKK / manpages / debian 12 / libgit-annex-perl / Git::Annex.3pm.en
Git::Annex(3pm) User Contributed Perl Documentation Git::Annex(3pm)

Git::Annex - Perl interface to git-annex repositories

version 0.008

  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));

An instance of the Git::Annex class represents a git repository in which "git annex init" has been run. This module provides some useful methods for working with such repositories from Perl. See <https://git-annex.branchable.com/> for more information on git-annex.

The root of the repository.

An instance of Git::Wrapper initialised in the repository.

Gives access to git-annex subcommands in the same way that Git::Annex::git gives access to git subcommands. So

    $self->git->annex("contentlocation", $key);

may be written

    $self->annex->contentlocation($key);

Instantiate an object representing a git-annex located in $dir.

Runs "git annex unused" and returns a hashref containing information on unused files.

The information is cached inside the ".git/annex" directory. This means that a user can keep running your script without repeatedly executing expensive "git annex" and "git log" commands.

Optional arguments:

If true, run "git log --stat -S" on each unused file, to see what filenames the unused data had if and when it was used data in the annex.

Defaults to false, but if there is log data in the cache it will always be returned.

Corresponds to the "--from" option to "git annex unused".
Corresponds to the "--used-refspec" option to "git annex unused".

Defaults to the "annex.used-refspec" git config key if set, or "+refs/heads/*:-refs/heads/synced/*".

Returns an absolute path to the content for git-annex key $key.

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;

Sean Whitton <spwhitton@spwhitton.name>

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
2022-12-24 perl v5.36.0