diff: Disable comparing modtimes when multimaster context is not found (#3226)
This commit is contained in:
+4
-1
@@ -90,6 +90,8 @@ func (d diffMessage) String() string {
|
||||
msg = console.Colorize("DiffSize", "! "+d.SecondURL)
|
||||
case differInMetadata:
|
||||
msg = console.Colorize("DiffMetadata", "! "+d.SecondURL)
|
||||
case differInMMSourceMTime:
|
||||
msg = console.Colorize("DiffMMSourceMTime", "! "+d.SecondURL)
|
||||
default:
|
||||
fatalIf(errDummy().Trace(d.FirstURL, d.SecondURL),
|
||||
"Unhandled difference between `"+d.FirstURL+"` and `"+d.SecondURL+"`.")
|
||||
@@ -201,7 +203,8 @@ func mainDiff(ctx *cli.Context) error {
|
||||
console.SetColor("DiffOnlyInSecond", color.New(color.FgGreen))
|
||||
console.SetColor("DiffType", color.New(color.FgMagenta))
|
||||
console.SetColor("DiffSize", color.New(color.FgYellow, color.Bold))
|
||||
console.SetColor("DiffTime", color.New(color.FgYellow, color.Bold))
|
||||
console.SetColor("DiffMetadata", color.New(color.FgYellow, color.Bold))
|
||||
console.SetColor("DiffMMSourceMTime", color.New(color.FgYellow, color.Bold))
|
||||
|
||||
URLs := ctx.Args()
|
||||
firstURL := URLs.Get(0)
|
||||
|
||||
+8
-1
@@ -34,11 +34,11 @@ type differType int
|
||||
const (
|
||||
differInNone differType = iota // does not differ
|
||||
differInSize // differs in size
|
||||
differInMMSourceMTime // differs in multi-master source modtime
|
||||
differInMetadata // differs in metadata
|
||||
differInType // differs in type, exfile/directory
|
||||
differInFirst // only in source (FIRST)
|
||||
differInSecond // only in target (SECOND)
|
||||
differInMMSourceMTime // differs in multi-master source modtime
|
||||
)
|
||||
|
||||
func (d differType) String() string {
|
||||
@@ -91,6 +91,13 @@ func multiMasterModTimeUpdated(src, dst *ClientContent) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
_, ok1 := src.UserMetadata[multiMasterSourceModTimeKey]
|
||||
_, ok2 := dst.UserMetadata[multiMasterSourceModTimeKey]
|
||||
if !ok1 && !ok2 {
|
||||
// No multimaster context found, consider src & dst as similar
|
||||
return false
|
||||
}
|
||||
|
||||
srcOriginLastModified, _ := time.Parse(time.RFC3339Nano, src.UserMetadata[multiMasterSourceModTimeKey])
|
||||
dstOriginLastModified, _ := time.Parse(time.RFC3339Nano, dst.UserMetadata[multiMasterSourceModTimeKey])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user