mirror of https://github.com/docker/docs.git
moving comment about sorting for clarity
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
parent
a3002aafd8
commit
a27e4f7471
|
@ -139,10 +139,10 @@ func loadAndValidateTargets(gun string, repo *tuf.Repo, roles map[string]storage
|
|||
}
|
||||
}
|
||||
|
||||
// by sorting, we'll always process shallower targets updates before deeper
|
||||
// N.B. RoleList sorts paths with fewer segments first.
|
||||
// By sorting, we'll always process shallower targets updates before deeper
|
||||
// ones (i.e. we'll load and validate targets before targets/foo). This
|
||||
// helps ensure we only load from storage when necessary in a cleaner way.
|
||||
// RoleList sorts paths with fewer segments first
|
||||
sort.Sort(targetsRoles)
|
||||
|
||||
updatesToApply := make([]storage.MetaUpdate, 0, len(targetsRoles))
|
||||
|
|
|
@ -16,7 +16,7 @@ func TestRoleListLess(t *testing.T) {
|
|||
rl := RoleList{"foo", "foo/bar", "bar/foo"}
|
||||
assert.True(t, rl.Less(0, 1))
|
||||
assert.False(t, rl.Less(1, 2))
|
||||
assert.False(t, rl.Less(2, 1))
|
||||
assert.True(t, rl.Less(2, 1))
|
||||
}
|
||||
|
||||
func TestRoleListSwap(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue