summaryrefslogtreecommitdiff
path: root/t/lib/t/Util.pm
blob: a69ac4c4ce06af0361f3aad2c8b3f0d10ee17d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package t::Util;

use 5.028;
use strict;
use warnings;
use parent 'Exporter';
use File::Slurp;
use File::Spec::Functions qw(rel2abs);

our @EXPORT = qw( corrupt_annexed_file );

sub corrupt_annexed_file {
    my ($git, $file) = @_;

    my ($key) = $git->annex("lookupkey", $file);
    my ($loc) = $git->annex("contentlocation", $key);
    $loc = rel2abs $loc, $git->dir;

    chmod 0777, $loc;
    append_file $loc, "bazbaz\n";
}

1;