diff --git a/src/restic/fuse/dir.go b/src/restic/fuse/dir.go index 004d02086..de970d526 100644 --- a/src/restic/fuse/dir.go +++ b/src/restic/fuse/dir.go @@ -97,7 +97,7 @@ func newDirFromSnapshot(repo restic.Repository, snapshot SnapshotWithId, ownerIs Mode: os.ModeDir | 0555, }, items: items, - inode: inodeFromBackendId(snapshot.ID), + inode: inodeFromBackendID(snapshot.ID), ownerIsRoot: ownerIsRoot, }, nil } diff --git a/src/restic/fuse/fuse.go b/src/restic/fuse/fuse.go index 45bf3342d..e8e45c445 100644 --- a/src/restic/fuse/fuse.go +++ b/src/restic/fuse/fuse.go @@ -11,6 +11,6 @@ import ( // inodeFromBackendId returns a unique uint64 from a backend id. // Endianness has no specific meaning, it is just the simplest way to // transform a []byte to an uint64 -func inodeFromBackendId(id restic.ID) uint64 { +func inodeFromBackendID(id restic.ID) uint64 { return binary.BigEndian.Uint64(id[:8]) } diff --git a/src/restic/fuse/snapshot.go b/src/restic/fuse/snapshot.go index b97e3ced9..e318a79dd 100644 --- a/src/restic/fuse/snapshot.go +++ b/src/restic/fuse/snapshot.go @@ -94,7 +94,7 @@ func (sn *SnapshotsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { ret := make([]fuse.Dirent, 0) for _, snapshot := range sn.knownSnapshots { ret = append(ret, fuse.Dirent{ - Inode: inodeFromBackendId(snapshot.ID), + Inode: inodeFromBackendID(snapshot.ID), Type: fuse.DT_Dir, Name: snapshot.Time.Format(time.RFC3339), }) diff --git a/src/restic/node.go b/src/restic/node.go index c4cff8ca5..bc80835bf 100644 --- a/src/restic/node.go +++ b/src/restic/node.go @@ -59,6 +59,7 @@ func (node Node) String() string { return fmt.Sprintf("", node.Type, node.Name) } +// Tree returns this node's tree object. func (node Node) Tree() *Tree { return node.tree } @@ -371,6 +372,7 @@ func (node Node) sameContent(other Node) bool { return true } +// IsNewer returns true of the file has been updated since the last Stat(). func (node *Node) IsNewer(path string, fi os.FileInfo) bool { if node.Type != "file" { debug.Log("node.IsNewer", "node %v is newer: not file", path) diff --git a/src/restic/test/backend.go b/src/restic/test/backend.go index e8710b8c8..9ed9a2efe 100644 --- a/src/restic/test/backend.go +++ b/src/restic/test/backend.go @@ -85,6 +85,7 @@ func TeardownRepo(repo restic.Repository) { } } +// SnapshotDir creates a new snapshot of path. func SnapshotDir(t testing.TB, repo restic.Repository, path string, parent *restic.ID) *restic.Snapshot { arch := archiver.New(repo) sn, _, err := arch.Snapshot(nil, []string{path}, parent)