1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

feat: add caching to avoid multiple clone

This commit is contained in:
Valentin Maerten
2025-11-15 17:36:04 +01:00
parent 5c8a387cd4
commit d8e44f960b
3 changed files with 194 additions and 17 deletions

View File

@@ -187,9 +187,20 @@ func (o *promptFuncOption) ApplyToReader(r *Reader) {
// building an [ast.TaskfileGraph] as it goes. If any errors occur, they will be
// returned immediately.
func (r *Reader) Read(ctx context.Context, node Node) (*ast.TaskfileGraph, error) {
startTime := time.Now()
// Clean up git cache after reading all taskfiles
defer func() {
_ = CleanGitCache()
}()
if err := r.include(ctx, node); err != nil {
return nil, err
}
elapsed := time.Since(startTime)
r.debugf("task: Taskfiles loaded in %.2fs\n", elapsed.Seconds())
return r.graph, nil
}