2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-10 07:11:06 +00:00

Address hound comments

This commit is contained in:
Alexander Neumann 2016-09-03 14:13:26 +02:00
parent 2054e3c026
commit 5170c4898a
5 changed files with 6 additions and 3 deletions

View File

@ -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
}

View File

@ -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])
}

View File

@ -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),
})

View File

@ -59,6 +59,7 @@ func (node Node) String() string {
return fmt.Sprintf("<Node(%s) %s>", 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)

View File

@ -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)