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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user