You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/models/issues
Lunny Xiao 5f82ead13c
Simplify how git repositories are opened (#28937)
## Purpose
This is a refactor toward building an abstraction over managing git
repositories.
Afterwards, it does not matter anymore if they are stored on the local
disk or somewhere remote.

## What this PR changes
We used `git.OpenRepository` everywhere previously.
Now, we should split them into two distinct functions:

Firstly, there are temporary repositories which do not change:

```go
git.OpenRepository(ctx, diskPath)
```

Gitea managed repositories having a record in the database in the
`repository` table are moved into the new package `gitrepo`:

```go
gitrepo.OpenRepository(ctx, repo_model.Repo)
```

Why is `repo_model.Repository` the second parameter instead of file
path?
Because then we can easily adapt our repository storage strategy.
The repositories can be stored locally, however, they could just as well
be stored on a remote server.

## Further changes in other PRs
- A Git Command wrapper on package `gitrepo` could be created. i.e.
`NewCommand(ctx, repo_model.Repository, commands...)`. `git.RunOpts{Dir:
repo.RepoPath()}`, the directory should be empty before invoking this
method and it can be filled in the function only. #28940
- Remove the `RepoPath()`/`WikiPath()` functions to reduce the
possibility of mistakes.

---------

Co-authored-by: delvh <dev.lh@web.de>
1 year ago
..
assignees.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
assignees_test.go Remove deadcode under models/issues (#28536) 1 year ago
comment.go Simplify how git repositories are opened (#28937) 1 year ago
comment_code.go Rework markup link rendering (#26745) 1 year ago
comment_list.go Add logs for data broken of comment review (#27326) 1 year ago
comment_test.go More `db.DefaultContext` refactor (#27265) 1 year ago
content_history.go Fix comment permissions (#28213) 1 year ago
content_history_test.go Fix comment permissions (#28213) 1 year ago
dependency.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
dependency_test.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
issue.go Remove deadcode under models/issues (#28536) 1 year ago
issue_index.go Another round of `db.DefaultContext` refactor (#27103) 1 year ago
issue_label.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
issue_label_test.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
issue_list.go
issue_list_test.go
issue_lock.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
issue_project.go Clean some functions about project issue (#27705) 1 year ago
issue_search.go Remove deadcode under models/issues (#28536) 1 year ago
issue_stats.go Another round of `db.DefaultContext` refactor (#27103) 1 year ago
issue_test.go Refactor deletion (#28610) 1 year ago
issue_update.go Don't use subselect in `DeleteIssuesByRepoID` (#27332) 1 year ago
issue_user.go Add combined index for issue_user.uid and issue_id (#28080) 1 year ago
issue_user_test.go Fix bug with sqlite load read (#26305) 2 years ago
issue_watch.go Even more `db.DefaultContext` refactor (#27352) 1 year ago
issue_watch_test.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
issue_xref.go More `db.DefaultContext` refactor (#27265) 1 year ago
issue_xref_test.go Replace 'userxx' with 'orgxx' in all test files when the user type is org (#27052) 1 year ago
label.go Refactor deletion (#28610) 1 year ago
label_test.go Remove deadcode under models/issues (#28536) 1 year ago
main_test.go make writing main test easier (#27270) 1 year ago
milestone.go Refactor timeutil package (#28623) 1 year ago
milestone_list.go Remove deadcode under models/issues (#28536) 1 year ago
milestone_test.go Remove deadcode under models/issues (#28536) 1 year ago
pull.go Simplify how git repositories are opened (#28937) 1 year ago
pull_list.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
pull_test.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
reaction.go Another round of `db.DefaultContext` refactor (#27103) 1 year ago
reaction_test.go Another round of `db.DefaultContext` refactor (#27103) 1 year ago
review.go Add support for sha256 repositories (#23894) 1 year ago
review_list.go Another round of `db.DefaultContext` refactor (#27103) 1 year ago
review_test.go Fix 500 when deleting a dismissed review (#27903) 1 year ago
stopwatch.go Remove deadcode under models/issues (#28536) 1 year ago
stopwatch_test.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
tracked_time.go Add ability to see open and closed issues at the same time (#28757) 1 year ago
tracked_time_test.go Add ability to see open and closed issues at the same time (#28757) 1 year ago