@ -13,6 +13,7 @@ import (
"math"
"math"
"code.gitea.io/gitea/modules/analyze"
"code.gitea.io/gitea/modules/analyze"
"code.gitea.io/gitea/modules/log"
"github.com/go-enry/go-enry/v2"
"github.com/go-enry/go-enry/v2"
)
)
@ -34,19 +35,19 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
}
}
shaBytes , typ , size , err := ReadBatchLine ( batchReader )
shaBytes , typ , size , err := ReadBatchLine ( batchReader )
if typ != "commit" {
if typ != "commit" {
lo g( "Unable to get commit for: %s. Err: %v" , commitID , err )
log . Debu g( "Unable to get commit for: %s. Err: %v" , commitID , err )
return nil , ErrNotExist { commitID , "" }
return nil , ErrNotExist { commitID , "" }
}
}
sha , err := NewIDFromString ( string ( shaBytes ) )
sha , err := NewIDFromString ( string ( shaBytes ) )
if err != nil {
if err != nil {
lo g( "Unable to get commit for: %s. Err: %v" , commitID , err )
log . Debu g( "Unable to get commit for: %s. Err: %v" , commitID , err )
return nil , ErrNotExist { commitID , "" }
return nil , ErrNotExist { commitID , "" }
}
}
commit , err := CommitFromReader ( repo , sha , io . LimitReader ( batchReader , size ) )
commit , err := CommitFromReader ( repo , sha , io . LimitReader ( batchReader , size ) )
if err != nil {
if err != nil {
lo g( "Unable to get commit for: %s. Err: %v" , commitID , err )
log . Debu g( "Unable to get commit for: %s. Err: %v" , commitID , err )
return nil , err
return nil , err
}
}
if _ , err = batchReader . Discard ( 1 ) ; err != nil {
if _ , err = batchReader . Discard ( 1 ) ; err != nil {
@ -79,7 +80,7 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
}
}
_ , _ , size , err := ReadBatchLine ( batchReader )
_ , _ , size , err := ReadBatchLine ( batchReader )
if err != nil {
if err != nil {
lo g( "Error reading blob: %s Err: %v" , f . ID . String ( ) , err )
log . Debu g( "Error reading blob: %s Err: %v" , f . ID . String ( ) , err )
return nil , err
return nil , err
}
}