SetShallow stores a list of shallow commit hashes in Redis.
(commits []plumbing.Hash)
| 16 | |
| 17 | // SetShallow stores a list of shallow commit hashes in Redis. |
| 18 | func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error { |
| 19 | key := withNamespace(s.namespacePrefix, shallowPrefix, "") |
| 20 | |
| 21 | // Convert plumbing.Hash slices to string slices for Redis. |
| 22 | var hashes []string |
| 23 | for _, hash := range commits { |
| 24 | hashes = append(hashes, hash.String()) |
| 25 | } |
| 26 | |
| 27 | // Use SAdd for adding items to a set. This operation is idempotent. |
| 28 | _, err := s.client.SAdd(ctx, key, hashes).Result() |
| 29 | return err |
| 30 | } |
| 31 | |
| 32 | // Shallow retrieves the list of shallow commit hashes from Redis. |
| 33 | func (s *ShallowStorage) Shallow() ([]plumbing.Hash, error) { |
nothing calls this directly
no test coverage detected