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/modules/git
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
..
foreachref Use refname:strip-2 instead of refname:short when syncing tags (#28797) 1 year ago
internal Refactor git command package to improve security and maintainability (#22678) 2 years ago
pipeline Improve ObjectFormat interface (#28496) 1 year ago
tests/repos Add support for sha256 repositories (#23894) 1 year ago
url Implement FSFE REUSE for golang files (#21840) 2 years ago
README.md
batch_reader.go Abstract hash function usage (#28138) 1 year ago
blame.go Abstract hash function usage (#28138) 1 year ago
blame_sha256_test.go Add support for sha256 repositories (#23894) 1 year ago
blame_test.go Adjust object format interface (#28469) 1 year ago
blob.go Fix profile render when the README.md size is larger than 1024 bytes (#25131) 2 years ago
blob_gogit.go Abstract hash function usage (#28138) 1 year ago
blob_nogogit.go Abstract hash function usage (#28138) 1 year ago
blob_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
command.go Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
command_race_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
command_test.go Improve git log for debugging (#24095) 2 years ago
commit.go Adjust object format interface (#28469) 1 year ago
commit_convert_gogit.go Abstract hash function usage (#28138) 1 year ago
commit_info.go Implement FSFE REUSE for golang files (#21840) 2 years ago
commit_info_gogit.go Abstract hash function usage (#28138) 1 year ago
commit_info_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
commit_info_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
commit_reader.go Add support for sha256 repositories (#23894) 1 year ago
commit_sha256_test.go Add support for sha256 repositories (#23894) 1 year ago
commit_test.go Improve ObjectFormat interface (#28496) 1 year ago
diff.go Implement FSFE REUSE for golang files (#21840) 2 years ago
diff_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
error.go Implement FSFE REUSE for golang files (#21840) 2 years ago
git.go Add support for sha256 repositories (#23894) 1 year ago
git_test.go Support changing git config through `app.ini`, use `diff.algorithm=histogram` by default (#24860) 2 years ago
hook.go Implement FSFE REUSE for golang files (#21840) 2 years ago
last_commit_cache.go Always enable caches (#28527) 1 year ago
last_commit_cache_gogit.go Abstract hash function usage (#28138) 1 year ago
last_commit_cache_nogogit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
log_name_status.go Abstract hash function usage (#28138) 1 year ago
notes.go Implement FSFE REUSE for golang files (#21840) 2 years ago
notes_gogit.go Abstract hash function usage (#28138) 1 year ago
notes_nogogit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
notes_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
object_format.go Add support for sha256 repositories (#23894) 1 year ago
object_id.go Add support for sha256 repositories (#23894) 1 year ago
object_id_gogit.go Add support for sha256 repositories (#23894) 1 year ago
object_id_test.go Adjust object format interface (#28469) 1 year ago
parse_gogit.go Improve ObjectFormat interface (#28496) 1 year ago
parse_gogit_test.go Improve ObjectFormat interface (#28496) 1 year ago
parse_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
parse_nogogit_test.go Improve ObjectFormat interface (#28496) 1 year ago
ref.go Adjust object format interface (#28469) 1 year ago
ref_test.go Use the type RefName for all the needed places and fix pull mirror sync bugs (#24634) 2 years ago
remote.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo.go Check for sha256 support to use --object-format flag (#28928) 1 year ago
repo_archive.go Fix archive creating LFS hooks and breaking pull requests (#28848) 1 year ago
repo_attribute.go Refactor legacy strange git operations (#22756) 2 years ago
repo_attribute_test.go Replace assert.Fail with assert.FailNow (#27578) 1 year ago
repo_base.go Simplify how git repositories are opened (#28937) 1 year ago
repo_base_gogit.go Update go dependencies and fix go-git (#28893) 1 year ago
repo_base_nogogit.go Add support for sha256 repositories (#23894) 1 year ago
repo_blame.go Remove `git.FileBlame` (#25841) 2 years ago
repo_blob.go Improve ObjectFormat interface (#28496) 1 year ago
repo_blob_gogit.go Abstract hash function usage (#28138) 1 year ago
repo_blob_nogogit.go Abstract hash function usage (#28138) 1 year ago
repo_blob_test.go Improve ObjectFormat interface (#28496) 1 year ago
repo_branch.go Simplify how git repositories are opened (#28937) 1 year ago
repo_branch_gogit.go Simplify how git repositories are opened (#28937) 1 year ago
repo_branch_nogogit.go Simplify how git repositories are opened (#28937) 1 year ago
repo_branch_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_commit.go Integration Test for Commit Search containing Square Brackets (#28751) 1 year ago
repo_commit_gogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_commit_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_commit_test.go Use more specific test methods (#24265) 2 years ago
repo_commitgraph.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_commitgraph_gogit.go Update go dependencies and fix go-git (#28893) 1 year ago
repo_compare.go Adjust object format interface (#28469) 1 year ago
repo_compare_test.go Adjust object format interface (#28469) 1 year ago
repo_gpg.go Abstract hash function usage (#28138) 1 year ago
repo_hook.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_index.go Improve ObjectFormat interface (#28496) 1 year ago
repo_language_stats.go Merge different languages for language stats (#24900) 2 years ago
repo_language_stats_gogit.go Merge different languages for language stats (#24900) 2 years ago
repo_language_stats_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_language_stats_test.go Merge different languages for language stats (#24900) 2 years ago
repo_object.go Improve ObjectFormat interface (#28496) 1 year ago
repo_ref.go Show branches and tags that contain a commit (#25180) 2 years ago
repo_ref_gogit.go Abstract hash function usage (#28138) 1 year ago
repo_ref_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_ref_test.go Fix commit retrieval by tag (#21804) 2 years ago
repo_stats.go Refactor git command package to improve security and maintainability (#22678) 2 years ago
repo_stats_test.go Fix commit retrieval by tag (#21804) 2 years ago
repo_tag.go Use refname:strip-2 instead of refname:short when syncing tags (#28797) 1 year ago
repo_tag_gogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_tag_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_tag_test.go Use refname:strip-2 instead of refname:short when syncing tags (#28797) 1 year ago
repo_test.go Faster git.GetDivergingCommits (#24482) 2 years ago
repo_tree.go Improve ObjectFormat interface (#28496) 1 year ago
repo_tree_gogit.go Improve ObjectFormat interface (#28496) 1 year ago
repo_tree_nogogit.go Improve ObjectFormat interface (#28496) 1 year ago
signature.go Implement FSFE REUSE for golang files (#21840) 2 years ago
signature_gogit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
signature_nogogit.go Update tool dependencies, lock govulncheck and actionlint (#25655) 2 years ago
submodule.go Upgrade to golangci-lint@v1.55.0 (#27756) 1 year ago
submodule_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
tag.go Improve ObjectFormat interface (#28496) 1 year ago
tag_test.go Adjust object format interface (#28469) 1 year ago
tree.go Abstract hash function usage (#28138) 1 year ago
tree_blob.go Implement FSFE REUSE for golang files (#21840) 2 years ago
tree_blob_gogit.go Abstract hash function usage (#28138) 1 year ago
tree_blob_nogogit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
tree_entry.go Remember to attach the parent tree when converting TreeEntry() -> Tree() (#22902) 2 years ago
tree_entry_gogit.go Abstract hash function usage (#28138) 1 year ago
tree_entry_mode.go Implement FSFE REUSE for golang files (#21840) 2 years ago
tree_entry_nogogit.go Abstract hash function usage (#28138) 1 year ago
tree_entry_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
tree_gogit.go Abstract hash function usage (#28138) 1 year ago
tree_nogogit.go Abstract hash function usage (#28138) 1 year ago
utils.go Replace `interface{}` with `any` (#25686) 2 years ago

README.md

Git Module

This module is merged from https://github.com/go-gitea/git which is a Go module to access Git through shell commands. Now it's a part of gitea's main repository for easier pull request.