mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Fix reflink: "auto" option
The docs say:
> The `auto` option uses reflinks when possible and falls back to plain
> copying when necessary.
I've been using this option for a while, and recently discovered that
despite the option, copying fails between two BTRFS filesystems with:
Error: OS/filesystem does not support reflinks. during link of paths /mnt/fs1/file, /mnt/fs2/file
I tracked this down to how the configuration is handled in the importer.
This commit is contained in:
parent
1b594790ca
commit
7bcca193d5
3 changed files with 27 additions and 0 deletions
|
|
@ -1684,6 +1684,8 @@ def manipulate_files(session, task):
|
||||||
operation = MoveOperation.LINK
|
operation = MoveOperation.LINK
|
||||||
elif session.config["hardlink"]:
|
elif session.config["hardlink"]:
|
||||||
operation = MoveOperation.HARDLINK
|
operation = MoveOperation.HARDLINK
|
||||||
|
elif session.config["reflink"] == "auto":
|
||||||
|
operation = MoveOperation.REFLINK_AUTO
|
||||||
elif session.config["reflink"]:
|
elif session.config["reflink"]:
|
||||||
operation = MoveOperation.REFLINK
|
operation = MoveOperation.REFLINK
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ Changelog goes here! Please add your entry to the bottom of one of the lists bel
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
* Improved naming of temporary files by separating the random part with the file extension.
|
* Improved naming of temporary files by separating the random part with the file extension.
|
||||||
|
* Fixed the ``auto`` value for the :ref:`reflink` config option.
|
||||||
|
|
||||||
For packagers:
|
For packagers:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,30 @@ class NonAutotaggedImportTest(_common.TestCase, ImportHelper):
|
||||||
== (s2[stat.ST_INO], s2[stat.ST_DEV])
|
== (s2[stat.ST_INO], s2[stat.ST_DEV])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@unittest.skipUnless(_common.HAVE_REFLINK, "need reflinks")
|
||||||
|
def test_import_reflink_arrives(self):
|
||||||
|
# Detecting reflinks is currently tricky due to various fs
|
||||||
|
# implementations, we'll just check the file exists.
|
||||||
|
config["import"]["reflink"] = True
|
||||||
|
self.importer.run()
|
||||||
|
for mediafile in self.import_media:
|
||||||
|
self.assert_file_in_lib(
|
||||||
|
b"Tag Artist",
|
||||||
|
b"Tag Album",
|
||||||
|
util.bytestring_path(f"{mediafile.title}.mp3"),
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_import_reflink_auto_arrives(self):
|
||||||
|
# Should pass regardless of reflink support due to fallback.
|
||||||
|
config["import"]["reflink"] = "auto"
|
||||||
|
self.importer.run()
|
||||||
|
for mediafile in self.import_media:
|
||||||
|
self.assert_file_in_lib(
|
||||||
|
b"Tag Artist",
|
||||||
|
b"Tag Album",
|
||||||
|
util.bytestring_path(f"{mediafile.title}.mp3"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_archive(session):
|
def create_archive(session):
|
||||||
(handle, path) = mkstemp(dir=py3_path(session.temp_dir))
|
(handle, path) = mkstemp(dir=py3_path(session.temp_dir))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue