1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/perl
use 5.028;
use strict;
use warnings;
use lib 't/lib';
use App::annex_to_annex;
use App::annex_to_annex_dropunused;
use Test::More;
use File::Spec::Functions qw(rel2abs);
use t::Setup;
use t::Util;
use File::chdir;
use File::Basename qw(dirname);
use File::Copy qw(copy);
plan skip_all => "device ID issues" if device_id_issues;
with_temp_annexes {
my (undef, undef, $source2) = @_;
run_bin qw(annex-to-annex --commit source1/foo source2/other dest);
{
local $CWD = "source2";
run_bin "annex-to-annex-dropunused";
$source2->checkout("master~1");
ok((lstat "other" and not stat "other"), "other was dropped");
}
};
with_temp_annexes {
my (undef, undef, $source2) = @_;
run_bin qw(annex-to-annex --commit source1/foo source2/other dest);
{
local $CWD = "source2";
$source2->checkout("master~1");
my ($other_key) = $source2->annex(qw(lookupkey other));
my ($other_content) = $source2->annex("contentlocation", $other_key);
$source2->checkout("master");
# break the hardlink
chmod 0755, dirname $other_content;
copy $other_content, "$other_content.tmp";
system "mv", "-f", "$other_content.tmp", $other_content;
chmod 0555, dirname $other_content;
run_bin "annex-to-annex-dropunused";
$source2->checkout("master~1");
ok((lstat "other" and stat "other"), "other was not dropped");
# $source2->checkout("master");
# run_bin qw(annex-to-annex-dropunused --dest=../dest);
# $source2->checkout("master~1");
# ok((lstat "other" and not stat "other"), "other was dropped");
}
};
# with_temp_annexes {
# my (undef, undef, $source2, $dest) = @_;
# run_bin qw(annex-to-annex --commit source1/foo source2/other dest);
# $dest->annex(qw(drop --force other));
# {
# local $CWD = "source2";
# $source2->checkout("master~1");
# my ($other_key) = $source2->annex(qw(lookupkey other));
# my ($other_content) = $source2->annex("contentlocation", $other_key);
# $source2->checkout("master");
# # break the hardlink
# chmod 0755, dirname $other_content;
# copy $other_content, "$other_content.tmp";
# system "mv", "-f", "$other_content.tmp", $other_content;
# chmod 0555, dirname $other_content;
# run_bin qw(annex-to-annex-dropunused --dest=../dest);
# $source2->checkout("master~1");
# ok((lstat "other" and stat "other"), "other was not dropped");
# }
# };
done_testing;
|