diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-22 19:17:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 19:17:30 +0800 |
commit | 226231ea27d4f2b0f09fa4efb39501507613b284 (patch) | |
tree | f7a45b173d4c96ff34c3fe7e7da8c73dce8a4ae3 /modules/git | |
parent | 2f060c5834d81f0317c795fc281f9a07e03e5962 (diff) | |
download | gitea-226231ea27d4f2b0f09fa4efb39501507613b284.tar.gz gitea-226231ea27d4f2b0f09fa4efb39501507613b284.zip |
Fix some pending problems (#29985)
These changes are quite independent and trivial, so I don't want to open
too many PRs.
* https://github.com/go-gitea/gitea/pull/29882#discussion_r1529607091
* the `f.Close` should be called properly
* the error message could be more meaningful
(https://github.com/go-gitea/gitea/pull/29882#pullrequestreview-1942557935)
*
https://github.com/go-gitea/gitea/pull/29859#pullrequestreview-1942324716
* the new translation strings don't take arguments
* https://github.com/go-gitea/gitea/pull/28710#discussion_r1443778807
* stale for long time
* #28140
* a form was forgotten to be changed to work with backend code
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/commit.go | 5 | ||||
-rw-r--r-- | modules/git/repo_stats.go | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go index 789a2e8f69..ef2676762c 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -397,9 +397,8 @@ func (c *Commit) GetSubModules() (*ObjectCache, error) { } } } - err = scanner.Err() - if err != nil { - return nil, fmt.Errorf("scan: %w", err) + if err = scanner.Err(); err != nil { + return nil, fmt.Errorf("GetSubModules scan: %w", err) } return c.submoduleCache, nil diff --git a/modules/git/repo_stats.go b/modules/git/repo_stats.go index ce82946873..83220104bd 100644 --- a/modules/git/repo_stats.go +++ b/modules/git/repo_stats.go @@ -124,9 +124,9 @@ func (repo *Repository) GetCodeActivityStats(fromTime time.Time, branch string) } } } - err = scanner.Err() - if err != nil { - return fmt.Errorf("scan: %w", err) + if err = scanner.Err(); err != nil { + _ = stdoutReader.Close() + return fmt.Errorf("GetCodeActivityStats scan: %w", err) } a := make([]*CodeActivityAuthor, 0, len(authors)) for _, v := range authors { |