diff --git a/src/cmds/restic/integration_helpers_unix_test.go b/src/cmds/restic/integration_helpers_unix_test.go index 0d8936d37..b8ef4bcdd 100644 --- a/src/cmds/restic/integration_helpers_unix_test.go +++ b/src/cmds/restic/integration_helpers_unix_test.go @@ -49,3 +49,25 @@ func nlink(info os.FileInfo) uint64 { stat, _ := info.Sys().(*syscall.Stat_t) return uint64(stat.Nlink) } + +func inode(info os.FileInfo) uint64 { + stat, _ := info.Sys().(*syscall.Stat_t) + return uint64(stat.Ino) +} + +func createFileSetPerHardlink(dir string) map[uint64][]string { + var stat syscall.Stat_t + linkTests := make(map[uint64][]string) + files, err := ioutil.ReadDir(dir) + if err != nil { + return nil + } + for _, f := range files { + + if err := syscall.Stat(filepath.Join(dir, f.Name()), &stat); err != nil { + return nil + } + linkTests[uint64(stat.Ino)] = append(linkTests[uint64(stat.Ino)], f.Name()) + } + return linkTests +} \ No newline at end of file diff --git a/src/cmds/restic/integration_helpers_windows_test.go b/src/cmds/restic/integration_helpers_windows_test.go index b2043152a..a3d1ec3f6 100644 --- a/src/cmds/restic/integration_helpers_windows_test.go +++ b/src/cmds/restic/integration_helpers_windows_test.go @@ -29,3 +29,21 @@ func (e *dirEntry) equals(other *dirEntry) bool { func nlink(info os.FileInfo) uint64 { return 1 } + +func inode(info os.FileInfo) uint64 { + return uint64(0) +} + +func createFileSetPerHardlink(dir string) map[uint64][]string { + var stat syscall.Stat_t + linkTests := make(map[uint64][]string) + files, err := ioutil.ReadDir(dir) + if err != nil { + return nil + } + for i, f := range files { + linkTests[i] = append(linkTests[i], f.Name()) + i++ + } + return linkTests +} \ No newline at end of file diff --git a/src/cmds/restic/integration_test.go b/src/cmds/restic/integration_test.go index 8af537b9c..f6dc7a786 100644 --- a/src/cmds/restic/integration_test.go +++ b/src/cmds/restic/integration_test.go @@ -1109,18 +1109,3 @@ func linkEqual(source, dest []string) bool { return true } -func createFileSetPerHardlink(dir string) map[uint64][]string { - var stat syscall.Stat_t - linkTests := make(map[uint64][]string) - files, err := ioutil.ReadDir(dir) - if err != nil { - return nil - } - for _, f := range files { - if err := syscall.Stat(filepath.Join(dir, f.Name()), &stat); err != nil { - return nil - } - linkTests[uint64(stat.Ino)] = append(linkTests[uint64(stat.Ino)], f.Name()) - } - return linkTests -}