chore: remove tracking inode change time (#10579)
Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
// Copyright (C) 2022 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//go:build darwin || freebsd || netbsd
|
||||
// +build darwin freebsd netbsd
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (fi basicFileInfo) InodeChangeTime() time.Time {
|
||||
if sys, ok := fi.Sys().(*syscall.Stat_t); ok {
|
||||
return time.Unix(0, sys.Ctimespec.Nano())
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright (C) 2022 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//go:build aix || dragonfly || linux || openbsd || solaris || illumos
|
||||
// +build aix dragonfly linux openbsd solaris illumos
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
)
|
||||
|
||||
func (fi basicFileInfo) InodeChangeTime() time.Time {
|
||||
// On Android, mtime and inode-change-time fluctuate, which can cause
|
||||
// conflicts even when nothing has been modified on the device itself.
|
||||
// Ref: https://forum.syncthing.net/t/keep-getting-conflicts-generated-on-android-device-for-files-modified-only-on-a-desktop-pc/19060
|
||||
if build.IsAndroid {
|
||||
return time.Time{}
|
||||
}
|
||||
if sys, ok := fi.FileInfo.Sys().(*syscall.Stat_t); ok {
|
||||
return time.Unix(0, sys.Ctim.Nano())
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var execExts map[string]bool
|
||||
@@ -58,10 +57,6 @@ func (e basicFileInfo) Group() int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (basicFileInfo) InodeChangeTime() time.Time {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
// osFileInfo converts e to os.FileInfo that is suitable
|
||||
// to be passed to os.SameFile.
|
||||
func (e *basicFileInfo) osFileInfo() os.FileInfo {
|
||||
|
||||
@@ -1024,7 +1024,3 @@ func (f *fakeFileInfo) Group() int {
|
||||
func (*fakeFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*fakeFileInfo) InodeChangeTime() time.Time {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,6 @@ type FileInfo interface {
|
||||
IsSymlink() bool
|
||||
Owner() int
|
||||
Group() int
|
||||
InodeChangeTime() time.Time // may be zero if not supported
|
||||
}
|
||||
|
||||
// FileMode is similar to os.FileMode
|
||||
|
||||
Reference in New Issue
Block a user