0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-03 00:47:33 +01:00
gitea/models/git
oliverpool d547b53cca
Add container.FilterSlice function (#30339)
Many places have the following logic:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	ids := make(container.Set[int64], len(jobs))
	for _, j := range jobs {
		if j.RunID == 0 {
			continue
		}
		ids.Add(j.RunID)
	}
	return ids.Values()
}
```

this introduces a `container.FilterMapUnique` function, which reduces
the code above to:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	return container.FilterMapUnique(jobs, func(j *ActionRunJob) (int64, bool) {
		return j.RunID, j.RunID != 0
	})
}
```
2024-04-09 20:27:30 +08:00
..
branch_list.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
branch_test.go Start to migrate from util.OptionalBool to optional.Option[bool] (#29329) 2024-02-23 02:18:33 +00:00
branch.go Sync branches to DB immediately when handle git hook calling (#29493) 2024-03-06 16:47:52 +08:00
commit_status_test.go Add testing for CalcCommitStatus (#28823) 2024-01-17 13:27:59 +00:00
commit_status.go Move from max( id ) to max( index ) for latest commit statuses (#30076) 2024-03-28 16:01:15 +08:00
lfs_lock.go
lfs.go
main_test.go
protected_banch_list_test.go
protected_branch_list.go Start to migrate from util.OptionalBool to optional.Option[bool] (#29329) 2024-02-23 02:18:33 +00:00
protected_branch_test.go
protected_branch.go Add branch protection setting for ignoring stale approvals (#28498) 2024-01-15 07:20:01 +00:00
protected_tag_test.go
protected_tag.go Refactor some legacy code and remove unused code (#28622) 2023-12-28 09:38:59 +00:00