MCPcopy
hub / github.com/syncthing/syncthing / currentAndLatestVersions

Function currentAndLatestVersions

build.go:1342–1358  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

1340}
1341
1342func currentAndLatestVersions(n int) ([]string, error) {
1343 bs, err := runError("git", "tag", "--sort", "taggerdate")
1344 if err != nil {
1345 return nil, err
1346 }
1347
1348 lines := strings.Split(string(bs), "\n")
1349 reverseStrings(lines)
1350
1351 // The one at the head is the latest version. We always keep that one.
1352 // Then we filter out remaining ones with dashes (pre-releases etc).
1353
1354 latest := lines[:1]
1355 nonPres := filterStrings(lines[1:], func(s string) bool { return !strings.Contains(s, "-") })
1356 vers := append(latest, nonPres...)
1357 return vers[:n], nil
1358}
1359
1360func reverseStrings(ss []string) {
1361 for i := 0; i < len(ss)/2; i++ {

Callers 1

runCommandFunction · 0.85

Calls 4

runErrorFunction · 0.85
reverseStringsFunction · 0.85
filterStringsFunction · 0.85
ContainsMethod · 0.80

Tested by

no test coverage detected