diff options
author | Lauris BH <lauris@nix.lv> | 2020-02-11 11:34:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 11:34:17 +0200 |
commit | ad2642a8aac9facb217a8471df1d3e00f1214e92 (patch) | |
tree | ea198b2b3130d22bb60886b6ba0a1df352f160ff /modules/indexer/code/git.go | |
parent | 37892be63580e40ced80e041ff2e7dabb2e80866 (diff) | |
download | gitea-ad2642a8aac9facb217a8471df1d3e00f1214e92.tar.gz gitea-ad2642a8aac9facb217a8471df1d3e00f1214e92.zip |
Language statistics bar for repositories (#8037)
* Implementation for calculating language statistics
Impement saving code language statistics to database
Implement rendering langauge stats
Add primary laguage to show in repository list
Implement repository stats indexer queue
Add indexer test
Refactor to use queue module
* Do not timeout for queues
Diffstat (limited to 'modules/indexer/code/git.go')
-rw-r--r-- | modules/indexer/code/git.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/indexer/code/git.go b/modules/indexer/code/git.go index 114d5a9e6d..37ab5ac3d3 100644 --- a/modules/indexer/code/git.go +++ b/modules/indexer/code/git.go @@ -35,11 +35,12 @@ func getDefaultBranchSha(repo *models.Repository) (string, error) { // getRepoChanges returns changes to repo since last indexer update func getRepoChanges(repo *models.Repository, revision string) (*repoChanges, error) { - if err := repo.GetIndexerStatus(); err != nil { + status, err := repo.GetIndexerStatus(models.RepoIndexerTypeCode) + if err != nil { return nil, err } - if len(repo.IndexerStatus.CommitSha) == 0 { + if len(status.CommitSha) == 0 { return genesisChanges(repo, revision) } return nonGenesisChanges(repo, revision) @@ -98,7 +99,7 @@ func genesisChanges(repo *models.Repository, revision string) (*repoChanges, err // nonGenesisChanges get changes since the previous indexer update func nonGenesisChanges(repo *models.Repository, revision string) (*repoChanges, error) { diffCmd := git.NewCommand("diff", "--name-status", - repo.IndexerStatus.CommitSha, revision) + repo.CodeIndexerStatus.CommitSha, revision) stdout, err := diffCmd.RunInDir(repo.RepoPath()) if err != nil { // previous commit sha may have been removed by a force push, so |