mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-05 05:20:34 +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 {
|
||||
result = deb.FilterLatestRefs(result)
|
||||
deb.FilterLatestRefs(result)
|
||||
}
|
||||
|
||||
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
|
||||
// packages and returns a reflist containing only the latest of each package.
|
||||
// This implements a "latest wins" approach which can be used while merging two
|
||||
// or more snapshots together.
|
||||
func FilterLatestRefs(r *PackageRefList) *PackageRefList {
|
||||
// packages and reduces it to only the latest of each package. The operations
|
||||
// are done in-place. This implements a "latest wins" approach which can be used
|
||||
// while merging two or more snapshots together.
|
||||
func FilterLatestRefs(r *PackageRefList) {
|
||||
// A running tab of latest seen package refs.
|
||||
latestRefs := make(map[string]int)
|
||||
|
||||
@@ -322,5 +322,5 @@ func FilterLatestRefs(r *PackageRefList) *PackageRefList {
|
||||
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])
|
||||
|
||||
prl := NewPackageRefListFromPackageList(rl)
|
||||
merged := FilterLatestRefs(prl)
|
||||
result := NewPackageRefListFromPackageList(rl)
|
||||
FilterLatestRefs(result)
|
||||
|
||||
c.Check(toStrSlice(merged), DeepEquals,
|
||||
c.Check(toStrSlice(result), DeepEquals,
|
||||
[]string{"Pi386 dpkg 1.6", "Pi386 lib 1.2"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user