MCPcopy
hub / github.com/kopia/kopia / compareMetadata

Function compareMetadata

internal/diff/diff.go:211–240  ·  view source on GitHub ↗

Checks for changes in e1's and e2's metadata when they have the same content, and updates the stats accordingly. The function is not concurrency safe, as it updates st without any locking.

(ctx context.Context, e1, e2 fs.Entry, path string, st *EntryTypeStats)

Source from the content-addressed store, hash-verified

209// and updates the stats accordingly.
210// The function is not concurrency safe, as it updates st without any locking.
211func compareMetadata(ctx context.Context, e1, e2 fs.Entry, path string, st *EntryTypeStats) {
212 var changed bool
213
214 if m1, m2 := e1.Mode(), e2.Mode(); m1 != m2 {
215 changed = true
216 st.SameContentButDifferentMode++
217 }
218
219 if mt1, mt2 := e1.ModTime(), e2.ModTime(); !mt1.Equal(mt2) {
220 changed = true
221 st.SameContentButDifferentModificationTime++
222 }
223
224 o1, o2 := e1.Owner(), e2.Owner()
225 if o1.UserID != o2.UserID {
226 changed = true
227 st.SameContentButDifferentUserOwner++
228 }
229
230 if o1.GroupID != o2.GroupID {
231 changed = true
232 st.SameContentButDifferentGroupOwner++
233 }
234
235 if changed {
236 st.SameContentButDifferentMetadata++
237
238 log(ctx).Debugf("content unchanged but metadata has been modified: %v", path)
239 }
240}
241
242func (c *Comparer) compareEntryMetadata(e1, e2 fs.Entry, fullpath string) {
243 switch {

Callers 1

compareEntryMethod · 0.70

Calls 4

EqualMethod · 0.80
OwnerMethod · 0.65
ModeMethod · 0.45
ModTimeMethod · 0.45

Tested by

no test coverage detected