diff --git a/src/restic/fuse/snapshot.go b/src/restic/fuse/snapshot.go index e318a79dd..d71adbc79 100644 --- a/src/restic/fuse/snapshot.go +++ b/src/restic/fuse/snapshot.go @@ -37,6 +37,7 @@ type SnapshotsDir struct { knownSnapshots map[string]SnapshotWithId } +// NewSnapshotsDir returns a new dir object for the snapshots. func NewSnapshotsDir(repo restic.Repository, ownerIsRoot bool) *SnapshotsDir { debug.Log("NewSnapshotsDir", "fuse mount initiated") return &SnapshotsDir{ diff --git a/src/restic/test/backend.go b/src/restic/test/backend.go index 9ed9a2efe..66567ab79 100644 --- a/src/restic/test/backend.go +++ b/src/restic/test/backend.go @@ -49,6 +49,7 @@ func getBoolVar(name string, defaultValue bool) bool { return defaultValue } +// SetupRepo returns a repo setup in a temp dir. func SetupRepo() restic.Repository { tempdir, err := ioutil.TempDir(TestTempDir, "restic-test-") if err != nil { @@ -70,6 +71,7 @@ func SetupRepo() restic.Repository { return repo } +// TeardownRepo removes a repository created by SetupRepo. func TeardownRepo(repo restic.Repository) { if !TestCleanupTempDirs { l := repo.Backend().(*local.Local) @@ -93,6 +95,7 @@ func SnapshotDir(t testing.TB, repo restic.Repository, path string, parent *rest return sn } +// WithRepo runs the function t with a repository that is removed after f returns. func WithRepo(t testing.TB, f func(restic.Repository)) { repo := SetupRepo() f(repo)