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/routers/web
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
..
admin Allow to sync tags from admin dashboard (#28045) 1 year ago
auth Normalize oauth email username (#28561) 1 year ago
devtest Make "cancel" buttons have proper type in modal forms (#25618) 2 years ago
events Implement FSFE REUSE for golang files (#21840) 2 years ago
explore Allow to set explore page default sort (#27951) 1 year ago
feed Set the `isPermaLink` attribute to `false` in the `guid` sub-element (#28860) 1 year ago
healthcheck Always enable caches (#28527) 1 year ago
misc Refactor CORS handler (#28587) 1 year ago
org Rework markup link rendering (#26745) 1 year ago
repo Simplify how git repositories are opened (#28937) 1 year ago
shared Simplify how git repositories are opened (#28937) 1 year ago
user Revert adding htmx until we finaly decide to add it (#28879) 1 year ago
base.go Fix panic in storageHandler (#27446) 1 year ago
githttp.go Add support for sha256 repositories (#23894) 1 year ago
goget.go Support SSH for go get (#24664) 2 years ago
home.go Enhanced auth token / remember me (#27606) 1 year ago
metrics.go Implement FSFE REUSE for golang files (#21840) 2 years ago
nodeinfo.go Implement FSFE REUSE for golang files (#21840) 2 years ago
swagger_json.go Start using template context function (#26254) 2 years ago
web.go Add support for sha256 repositories (#23894) 1 year ago
webfinger.go Add a link to OpenID Issuer URL in WebFinger response (#26000) 2 years ago