Commit Graph

15 Commits (0453177b611cab92d8ee093012c5bc33d364b41d)

Author SHA1 Message Date
TheFox0x7 ae3a18e01a
Remove context from git struct ()
Argument is moved from struct init in command run, which lets us remove
context from struct.
wxiaoguang 56a0a9c750
Fix git empty check and HEAD request ()
wxiaoguang f35850f48e
Refactor error system ()
wxiaoguang 2a828e2798
Clarify path param naming ()
In history (from some legacy frameworks), both `:name` and `name` are
supported as path path name, `:name` is an alias to `name`.

To make code consistent, now we should only use `name` but not `:name`.

Also added panic check in related functions to make sure the name won't
be abused in case some downstreams still use them.
wxiaoguang 52b319bc00
Refactor pprof labels and process desc ()
* Deprecate "gopid" in log, it is not useful and requires very hacky
approach
* Remove "git.Command.SetDescription" because it is not useful and only
makes the logs too flexible
wxiaoguang e524f63d58
Fix git error handling ()
Lunny Xiao a802508f88
Fix wrong last modify time ()
wxiaoguang 43c7a2e7b1
Refactor names ()
This PR only does "renaming":

* `Route` should be `Router` (and chi router is also called "router")
* `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`)
* Use lower case for private functions to avoid exposing or abusing
wxiaoguang 7c613f100e
Make sure git version&feature are always prepared ()
Otherwise there would be more similar issues like 
Lunny Xiao 29f149bd9f
Move context from modules to services ()
Since `modules/context` has to depend on `models` and many other
packages, it should be moved from `modules/context` to
`services/context` according to design principles. There is no logic
code change on this PR, only move packages.

- Move `code.gitea.io/gitea/modules/context` to
`code.gitea.io/gitea/services/context`
- Move `code.gitea.io/gitea/modules/contexttest` to
`code.gitea.io/gitea/services/contexttest` because of depending on
context
- Move `code.gitea.io/gitea/modules/upload` to
`code.gitea.io/gitea/services/context/upload` because of depending on
context
wxiaoguang 1ef87773b1
Refactor modules/git global variables ()
Move some global variables into a struct to improve maintainability
Lunny Xiao 3b50dd95ce
Some refactor for git http ()
# Purpose

This PR makes git http related functions use the same `context.Context`
so they can be maintained easier.
Lunny Xiao 408a484224
Adjust object format interface ()
- Remove `ObjectFormatID`
- Remove function `ObjectFormatFromID`.
- Use `Sha1ObjectFormat` directly but not a pointer because it's an
empty struct.
- Store `ObjectFormatName` in `repository` struct
Adam Majer cbf923e87b
Abstract hash function usage ()
Refactor Hash interfaces and centralize hash function. This will allow
easier introduction of different hash function later on.

This forms the "no-op" part of the SHA256 enablement patch.
Lunny Xiao 0ba4ecc3bd
Fix http protocol auth ()