(ctx context.Context, commit string)
| 167 | } |
| 168 | |
| 169 | func (r sourceRepo) GetFiles(ctx context.Context, commit string) ([]content.File, error) { |
| 170 | l := r.l.Lock(r.dirName) |
| 171 | defer l.Unlock() |
| 172 | |
| 173 | r.trace(ctx, slog.LevelInfo, "upstream call", |
| 174 | slog.String("target", "localgit.GetFiles"), |
| 175 | slog.String("owner", r.repo.Owner), |
| 176 | slog.String("repo", r.repo.Name), |
| 177 | slog.String("module", r.repo.Name), |
| 178 | slog.String("commit", commit), |
| 179 | slog.String("commit_id", commit), |
| 180 | ) |
| 181 | start := time.Now() |
| 182 | |
| 183 | if _, _, err := getRepoSwitchedCommit(r.dirName, commit); err != nil { |
| 184 | r.trace(ctx, slog.LevelWarn, "upstream result", |
| 185 | slog.String("target", "localgit.GetFiles"), |
| 186 | slog.String("owner", r.repo.Owner), |
| 187 | slog.String("repo", r.repo.Name), |
| 188 | slog.String("module", r.repo.Name), |
| 189 | slog.String("commit", commit), |
| 190 | slog.String("commit_id", commit), |
| 191 | slog.String("outcome", "error"), |
| 192 | slog.Duration("duration", time.Since(start)), |
| 193 | slog.String("error", err.Error()), |
| 194 | ) |
| 195 | return nil, fmt.Errorf("investigating %q/%q:%q: %w", r.repo.Owner, r.repo.Name, commit, err) |
| 196 | } |
| 197 | |
| 198 | enumStart := time.Now() |
| 199 | files, err := enumerateProto(r.dirName, r.repo) |
| 200 | enumLatency := time.Since(enumStart) |
| 201 | if err != nil { |
| 202 | r.trace(ctx, slog.LevelWarn, "upstream result", |
| 203 | slog.String("target", "localgit.GetFiles"), |
| 204 | slog.String("owner", r.repo.Owner), |
| 205 | slog.String("repo", r.repo.Name), |
| 206 | slog.String("module", r.repo.Name), |
| 207 | slog.String("commit", commit), |
| 208 | slog.String("commit_id", commit), |
| 209 | slog.String("outcome", "error"), |
| 210 | slog.Duration("enum_latency", enumLatency), |
| 211 | slog.Duration("duration", time.Since(start)), |
| 212 | slog.String("error", err.Error()), |
| 213 | ) |
| 214 | return files, fmt.Errorf("enumerating %q/%q:%q: %w", r.repo.Owner, r.repo.Name, commit, err) |
| 215 | } |
| 216 | |
| 217 | r.trace(ctx, slog.LevelInfo, "upstream result", |
| 218 | slog.String("target", "localgit.GetFiles"), |
| 219 | slog.String("owner", r.repo.Owner), |
| 220 | slog.String("repo", r.repo.Name), |
| 221 | slog.String("module", r.repo.Name), |
| 222 | slog.String("commit", commit), |
| 223 | slog.String("commit_id", commit), |
| 224 | slog.String("outcome", "ok"), |
| 225 | slog.Int("files", len(files)), |
| 226 | slog.Int("bytes", fileBytes(files)), |
nothing calls this directly
no test coverage detected