summaryrefslogtreecommitdiff
path: root/t/lib/t/Util.pm
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/t/Util.pm')
-rw-r--r--t/lib/t/Util.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/t/lib/t/Util.pm b/t/lib/t/Util.pm
index a69ac4c..bb8f59e 100644
--- a/t/lib/t/Util.pm
+++ b/t/lib/t/Util.pm
@@ -6,8 +6,10 @@ use warnings;
use parent 'Exporter';
use File::Slurp;
use File::Spec::Functions qw(rel2abs);
+use File::chdir;
+use File::Temp qw(tempdir);
-our @EXPORT = qw( corrupt_annexed_file );
+our @EXPORT = qw( corrupt_annexed_file device_id_issues );
sub corrupt_annexed_file {
my ($git, $file) = @_;
@@ -20,4 +22,19 @@ sub corrupt_annexed_file {
append_file $loc, "bazbaz\n";
}
+# on a tmpfs as commonly used with sbuild, the device IDs for files
+# and directories can be different, which will cause annex-to-annex to
+# refuse to hardlink. we use this sub to skip some tests if we detect
+# that. possibly annex-to-annex should only look at the device IDs of
+# files (by creating a temporary file inside $dest and looking at the
+# device ID of that)
+sub device_id_issues {
+ local $CWD = tempdir CLEANUP => 1;
+ mkdir "foo";
+ write_file "bar", "bar\n";
+ my $foo_id = (stat "foo")[0];
+ my $bar_id = (stat "bar")[0];
+ return($foo_id != $bar_id);
+}
+
1;