Skip to content

Commit 9363b59

Browse files
committed
Allow exit when caculating language in gogit version
1 parent 57ba668 commit 9363b59

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modules/git/languagestats/language_stats_gogit.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ func CalcLanguageStats(ctx context.Context, repo *git_module.Repository, commitI
5959
firstExcludedLanguageSize := int64(0)
6060

6161
err = tree.Files().ForEach(func(f *object.File) error {
62+
select {
63+
case <-ctx.Done():
64+
return ctx.Err()
65+
default:
66+
return nil
67+
}
68+
6269
if f.Size == 0 {
6370
return nil
6471
}

0 commit comments

Comments
 (0)