mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
snapshot: FilterLatestRefs returns nothing as it deals with a pointer.
This commit is contained in:
@@ -38,7 +38,7 @@ func aptlySnapshotMerge(cmd *commander.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if latest {
|
if latest {
|
||||||
result = deb.FilterLatestRefs(result)
|
deb.FilterLatestRefs(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceDescription := make([]string, len(sources))
|
sourceDescription := make([]string, len(sources))
|
||||||
|
|||||||
+5
-5
@@ -286,10 +286,10 @@ func (l *PackageRefList) Merge(r *PackageRefList, overrideMatching bool) (result
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FilterLatestRefs takes in a reflist with potentially multiples of the same
|
// FilterLatestRefs takes in a reflist with potentially multiples of the same
|
||||||
// packages and returns a reflist containing only the latest of each package.
|
// packages and reduces it to only the latest of each package. The operations
|
||||||
// This implements a "latest wins" approach which can be used while merging two
|
// are done in-place. This implements a "latest wins" approach which can be used
|
||||||
// or more snapshots together.
|
// while merging two or more snapshots together.
|
||||||
func FilterLatestRefs(r *PackageRefList) *PackageRefList {
|
func FilterLatestRefs(r *PackageRefList) {
|
||||||
// A running tab of latest seen package refs.
|
// A running tab of latest seen package refs.
|
||||||
latestRefs := make(map[string]int)
|
latestRefs := make(map[string]int)
|
||||||
|
|
||||||
@@ -322,5 +322,5 @@ func FilterLatestRefs(r *PackageRefList) *PackageRefList {
|
|||||||
i -= 1
|
i -= 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -304,9 +304,9 @@ func (s *PackageRefListSuite) TestFilterLatestRefs(c *C) {
|
|||||||
rl.Add(packages[7])
|
rl.Add(packages[7])
|
||||||
rl.Add(packages[7])
|
rl.Add(packages[7])
|
||||||
|
|
||||||
prl := NewPackageRefListFromPackageList(rl)
|
result := NewPackageRefListFromPackageList(rl)
|
||||||
merged := FilterLatestRefs(prl)
|
FilterLatestRefs(result)
|
||||||
|
|
||||||
c.Check(toStrSlice(merged), DeepEquals,
|
c.Check(toStrSlice(result), DeepEquals,
|
||||||
[]string{"Pi386 dpkg 1.6", "Pi386 lib 1.2"})
|
[]string{"Pi386 dpkg 1.6", "Pi386 lib 1.2"})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user