Fix missing close in WalkGitLog #17008

Merged
lunny merged 1 commits from fix-17007-add-missing-defer into main 2021-09-10 09:46:13 +00:00
Contributor

When the external context is cancelled it is possible for the
GitLogReader to not itself be Closed.

This PR does three things:

  1. Instead of adding a plain defer it wraps the g.Close in a func as
    g may change.
  2. It adds the missing explicit g.Close - although the defer fix makes
    this unnecessary.
  3. It passes down the external context as the base context for the
    GitLogReader meaning that the cancellation of the external context will
    pass down automatically.

Fix #17007

Signed-off-by: Andrew Thornton art27@cantab.net

When the external context is cancelled it is possible for the GitLogReader to not itself be Closed. This PR does three things: 1. Instead of adding a plain defer it wraps the `g.Close` in a func as `g` may change. 2. It adds the missing explicit `g.Close` - although the defer fix makes this unnecessary. 3. It passes down the external context as the base context for the GitLogReader meaning that the cancellation of the external context will pass down automatically. Fix #17007 Signed-off-by: Andrew Thornton <art27@cantab.net>
6543 (Migrated from github.com) approved these changes 2021-09-10 09:13:33 +00:00
axifive (Migrated from github.com) approved these changes 2021-09-10 09:22:21 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#17008
No description provided.