Implement diff.compareSysStat on windows
and update diff tests to work with slash paths on windows Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
5025b53704
commit
666d946455
@ -322,20 +322,20 @@ func changesString(c []TestChange) string {
|
|||||||
func Add(p string) TestChange {
|
func Add(p string) TestChange {
|
||||||
return TestChange{
|
return TestChange{
|
||||||
Kind: ChangeKindAdd,
|
Kind: ChangeKindAdd,
|
||||||
Path: p,
|
Path: filepath.FromSlash(p),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Delete(p string) TestChange {
|
func Delete(p string) TestChange {
|
||||||
return TestChange{
|
return TestChange{
|
||||||
Kind: ChangeKindDelete,
|
Kind: ChangeKindDelete,
|
||||||
Path: p,
|
Path: filepath.FromSlash(p),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Modify(p string) TestChange {
|
func Modify(p string) TestChange {
|
||||||
return TestChange{
|
return TestChange{
|
||||||
Kind: ChangeKindModify,
|
Kind: ChangeKindModify,
|
||||||
Path: p,
|
Path: filepath.FromSlash(p),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
package fs
|
package fs
|
||||||
|
|
||||||
import "os"
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
|
)
|
||||||
|
|
||||||
func detectDirDiff(upper, lower string) *diffDirOptions {
|
func detectDirDiff(upper, lower string) *diffDirOptions {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func compareSysStat(s1, s2 interface{}) (bool, error) {
|
func compareSysStat(s1, s2 interface{}) (bool, error) {
|
||||||
// TODO: Use windows specific sys type
|
f1, ok := s1.(windows.Win32FileAttributeData)
|
||||||
|
if !ok {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
}
|
||||||
|
f2, ok := s2.(windows.Win32FileAttributeData)
|
||||||
|
if !ok {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return f1.FileAttributes == f2.FileAttributes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func compareCapabilities(p1, p2 string) (bool, error) {
|
func compareCapabilities(p1, p2 string) (bool, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user