mirror of
https://github.com/restic/restic.git
synced 2025-10-27 20:09:41 +00:00
fs: remove os.FileInfo from fs.ExtendedFileInfo
Only the `Sys()` value from os.FileInfo is kept as field `sys` to support Windows. The os.FileInfo removal ensures that for values like `ModTime` that existed in both data structures there's no more confusion which value is actually used.
This commit is contained in:
@@ -84,7 +84,7 @@ func checkMetadata(t *testing.T, f File, path string, follow bool, nodeType rest
|
||||
fi2, err = os.Lstat(path)
|
||||
}
|
||||
rtest.OK(t, err)
|
||||
assertFIEqual(t, fi2, fi.FileInfo)
|
||||
assertFIEqual(t, fi2, fi)
|
||||
|
||||
node, err := f.ToNode(false)
|
||||
rtest.OK(t, err)
|
||||
@@ -94,13 +94,12 @@ func checkMetadata(t *testing.T, f File, path string, follow bool, nodeType rest
|
||||
rtest.Equals(t, nodeType, node.Type, "node Type")
|
||||
}
|
||||
|
||||
func assertFIEqual(t *testing.T, want os.FileInfo, got os.FileInfo) {
|
||||
func assertFIEqual(t *testing.T, want os.FileInfo, got *ExtendedFileInfo) {
|
||||
t.Helper()
|
||||
rtest.Equals(t, want.Name(), got.Name(), "Name")
|
||||
rtest.Equals(t, want.IsDir(), got.IsDir(), "IsDir")
|
||||
rtest.Equals(t, want.ModTime(), got.ModTime(), "ModTime")
|
||||
rtest.Equals(t, want.Mode(), got.Mode(), "Mode")
|
||||
rtest.Equals(t, want.Size(), got.Size(), "Size")
|
||||
rtest.Equals(t, want.Name(), got.Name, "Name")
|
||||
rtest.Equals(t, want.ModTime(), got.ModTime, "ModTime")
|
||||
rtest.Equals(t, want.Mode(), got.Mode, "Mode")
|
||||
rtest.Equals(t, want.Size(), got.Size, "Size")
|
||||
}
|
||||
|
||||
func TestFSLocalRead(t *testing.T) {
|
||||
@@ -206,7 +205,7 @@ func TestFSLocalTypeChange(t *testing.T) {
|
||||
|
||||
fi, err := f.Stat()
|
||||
rtest.OK(t, err)
|
||||
if !fi.IsDir() {
|
||||
if !fi.Mode.IsDir() {
|
||||
// a file handle based implementation should still reference the file
|
||||
checkMetadata(t, f, pathNew, false, restic.NodeTypeFile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user