forked from gitea/gitea

* Defer closing the gitrepo until the end of the wrapped context functions (#15653) Backport #15653 There was a mistake in #15372 where deferral of gitrepo close occurs before it should. This PR fixes this.
* Defer closing the gitrepo until the end of the wrapped context functions (#15653) Backport #15653 There was a mistake in #15372 where deferral of gitrepo close occurs before it should. This PR fixes this.