Skip to content

Avoid copying media twice on filesystems without hard links #236

Open

Description

@neoromantic

When tg media download --out exports to a filesystem without hard links, it first writes the cached file to a temporary file next to the destination. After the link fails, it writes the same bytes a second time into the destination opened with wx. A large export can need nearly twice the file size in free space on the destination volume. Ctrl-C during the first copy waits for that copy to finish.

Make this path write the file contents once and respond to cancellation throughout the copy. Preserve the independent cached file, the no-overwrite guarantee, batch collision handling and atomic publication where the filesystem supports it. A partial public file on interruption should still be reported so the user can inspect it before replacing it.

Cover the no-hard-link path with offline tests for cancellation, identical and conflicting outputs, and the number of full-file writes. See the author’s final review of #181.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions