Commit Graph

9638 Commits

Author SHA1 Message Date
Michael Eischer ee53632ec6 restic: remove Key() from repository interface
All callers use the concrete Repository type
2026-06-05 13:24:49 +02:00
Michael Eischer 8118963d6e cache: remove dependency on crypto package for truncation checks
The cache backend + repository can by now properly recover from damaged
files stored in the cache. Thus, remove the legacy sanity check.
2026-06-05 13:19:29 +02:00
Michael Eischer c967d634be repository: add PackBlob.UncompressedCiphertextLength() 2026-06-05 13:18:59 +02:00
Michael Eischer e247118f49 repository: move Blob, Blobs and PackedBlob to pack package
This removes them from the public interface. The latter now only
provides the PackBlob interface, without being bound to the type used
internally by the pack package.
2026-06-05 12:25:03 +02:00
Michael Eischer 064144284f restic: change LookupBlob to return []PackBlob 2026-06-05 12:22:51 +02:00
Michael Eischer 10fc70668c restic: change ListBlobs to return PackBlob
PackBlob is a limited interface that only exposes a part of the
information provided by PackedBlob. Most of the changes are switches
from direct value lookups to the interface methods, with a few larger
changes to let the tests still work.
2026-06-05 12:22:51 +02:00
Michael Eischer 784b52bdea restic: add PackBlob interface and implement it on PackedBlob
The PackBlob interface will allow hiding details from the public
interface, in particular, the offset of a blob within a pack file.
2026-06-05 12:22:51 +02:00
Michael Eischer c5acfe9469 repository: unexport listPacksFromIndex
`ListPacksFromIndex` only has repository-internal callers left (besides
test code).
2026-06-05 12:22:51 +02:00
Michael Eischer 781c6a12ae restic: list pack header via ListPackHandles
Replace ListPack with ListPackHandles so callers only receive blob
handles from pack headers, not layout fields.
2026-06-05 12:22:51 +02:00
Michael Eischer be43815d5d restic: switch LoadBlobsFromPack to BlobHandles
LoadBlobsFromPack now resolves the handles to Blobs. Repository internal
code can still use the Blob-based method.

The loader used in the filerestorer test now has to implement sorting
the blobs by offset itself as it no longer has access to the repository-internal
dataypes.
2026-06-05 12:22:51 +02:00
Michael Eischer 122406ede6 repository: require *Repository for CopyBlobs
Prepare `CopyBlobs` to allow access to unexported methods of the
Repository struct. This requires changing the test to inject the number
of backend connections via a wrapped backend instead of a wrapped
repository.
2026-06-05 12:22:51 +02:00
Michael Eischer a20203e53f restic: move test helpers and drop unused JSONUnpackedLoader 2026-06-04 23:25:53 +02:00
Michael Eischer 366915e16b repository: require *Repository for ExaminePack
The function wouldn't work with a different Repository implementation
anyways.
2026-06-04 23:24:27 +02:00
Michael Eischer 5d52705064 debug: move DumpPacks into repository package
Processing pack file internals belongs into the repository package.
2026-06-04 23:23:00 +02:00
Michael Eischer 8844cf1876 repository: rename PackError to ErrPackMetadata 2026-06-04 23:17:56 +02:00
Michael Eischer 8b19ddeda8 repository: merge check.go into checker.go 2026-06-04 23:17:35 +02:00
Michael Eischer 7d25ca9d67 repository: omit unused headerSize from ListPack() 2026-05-31 22:53:00 +02:00
Michael Eischer cc546b71e3 debug: move code requring internal access to repository package 2026-05-31 22:48:38 +02:00
Michael Eischer 3cb49556f5 repair index: replace full index handling integration test with unit test 2026-05-31 22:39:16 +02:00
Michael Eischer f625190393 check: simplify index damage test 2026-05-31 22:19:15 +02:00
Michael Eischer 620f5986f8 list index: use helper in repository package 2026-05-31 22:14:01 +02:00
Michael Eischer 49c7364e79 add golangci-lint rule to prevent imports of repository internals 2026-05-31 18:20:37 +02:00
MetalSpork 042feb2b7f docs: expand restic cat documentation (#5679)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-05-31 15:46:45 +00:00
Michael Eischer 474c094cac Merge pull request #21817 from eyupcanakman/fix/sftp-dir-permissions
sftp: Use mode 0700 for repository directories
2026-05-31 16:40:17 +02:00
Winfried Plappert 7566069bf3 docs: amend restic find documentation (#21818)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2026-05-31 16:31:44 +02:00
Michael Eischer 53de77ea1a Merge pull request #21828 from MichaelEischer/fix-split-pack-index
repository: repair index: correctly handle split index entries
2026-05-31 16:30:49 +02:00
Michael Eischer a54ac48f60 restic: test that sorting nil blobs slices works 2026-05-31 16:22:58 +02:00
Michael Eischer 91a6e74fd5 repository: test split index handling in index rewrite 2026-05-31 16:22:58 +02:00
Michael Eischer e666980cec add changelog for split pack index handling 2026-05-31 16:22:58 +02:00
Michael Eischer 78b3411076 check: consider split pack index entries as repository damage 2026-05-31 15:58:33 +02:00
Michael Eischer 5b39ad861e repository: repair index: correctly handle split index entries
In restic <0.10.0, it was possible that the blobs of a pack file were
split across multiple indexes. `MasterIndex.Rewrite` however assumed
that each an index always contains the full description of a pack file.
Therefore, further index entries for a pack were filtered out as
duplicates. Now, the code also checks the blobs contained in the index
entry while filtering out duplicates.
2026-05-31 15:58:29 +02:00
Michael Eischer f86307d223 Merge pull request #21827 from MichaelEischer/fix-pack-repair
repair packs: correctly handle packs with missing/incomplete index entry
2026-05-31 15:57:50 +02:00
Michael Eischer 77a6bf3bb7 Merge pull request #21797 from MichaelEischer/always-include-explicit-targets
backup: prevent exclude of backup targets
2026-05-31 15:42:26 +02:00
Michael Eischer c95ef18afb repository: fix error handling in repair pack if blob upload fails 2026-05-31 15:40:15 +02:00
Michael Eischer 4c23c5946f add repair packs changelog 2026-05-31 15:40:15 +02:00
Michael Eischer 640b2489f6 repository: repair pack: test handling of not indexed packs 2026-05-31 15:40:15 +02:00
Michael Eischer 6a3f447327 repository: repair pack: correctly handle incomplete index 2026-05-31 15:40:15 +02:00
Michael Eischer ce24640d75 backup: prevent hang using --stdin-from-command if upload fails (#21829) 2026-05-31 15:27:05 +02:00
Michael Eischer 7e8f9a9221 document excludes for explicit backup sources 2026-05-31 15:24:43 +02:00
Eyüp Can Akman 62cf574fd8 sftp: Use mode 0700 for repository directories
The SFTP backend created repository directories with pkg/sftp's Mkdir
and MkdirAll, which take no mode argument, so the directories inherited
the SFTP server's umask instead of the 0700 used for local
repositories. Set the mode of each directory the backend creates.
2026-05-31 12:40:26 +03:00
Michael Eischer 32bcd92f60 archiver: test that explicit backup paths ignore excludes 2026-05-30 22:30:30 +02:00
Michael Eischer 02cf8e5f23 backup: prevent exclude of backup targets
Track backup targets explicitly specified by the user and prevent
excluding them. This for example ensures that `restic backup
--exclude-if-present .git /home/user/data` backs up the `data` folder
even if there is a `.git` folder in `/home/user`.

Note that this does not suffice for commands like `restic backup --exclude data /home/user/data`
as the exclude pattern will still match every single file within `data`.
2026-05-30 22:30:30 +02:00
Yaroslav Halchenko 451cc6c048 Add codespell support with configuration and fixes (#21807)
Co-authored-by: Claude Code 2.1.142 / Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 20:15:13 +00:00
Michael Eischer c221cd06ad repository: forget id of unreadable packs on index rebuild (#21826) 2026-05-30 22:09:33 +02:00
Michael Eischer e7d3a4ae51 repository: repair pack: move pack reupload to helper 2026-05-30 10:15:16 +02:00
Michael Eischer 2a95591b48 index: replace custom EachByPackResult datatype 2026-05-30 10:11:18 +02:00
Michael Eischer c669cc7a7d introduce restic.Blobs type with sort method 2026-05-30 10:10:39 +02:00
Michael Eischer 2802bec8b9 Polish changelogs (#21805) 2026-05-29 21:06:29 +02:00
Michael Eischer f000da3b35 Return helpful error if subfolder syntax fails on Windows (#21813) 2026-05-20 22:55:01 +02:00
Michael Eischer dd4f1f06a1 Merge pull request #21810 from MichaelEischer/cmd-doc-typos
Fix command doc typos and update help for check/rewrite
2026-05-20 22:54:40 +02:00