Commit Graph
9 Commits
Author SHA1 Message Date
wxiaoguang 750a8465f5 A better go code formatter, and now make fmt can run in Windows (#17684)
* go build / format tools
* re-format imports
2021-11-17 20:34:35 +08:00
zeripath 51775f65bc Make commit info cancelable (#16032)
* Make modules/context.Context a context.Context

Signed-off-by: Andrew Thornton <[email protected]>

* Simplify context calls

Signed-off-by: Andrew Thornton <[email protected]>

* Set the base context for requests to the HammerContext

Signed-off-by: Andrew Thornton <[email protected]>

* pass context into get-last-commit

Signed-off-by: Andrew Thornton <[email protected]>

* Make commit_info cancellable

Signed-off-by: Andrew Thornton <[email protected]>

* use context as context

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
2021-06-06 19:44:58 -04:00
zeripath 511f6138d4 Use native git variants by default with go-git variants as build tag (#13673)
* Move last commit cache back into modules/git

Signed-off-by: Andrew Thornton <[email protected]>

* Remove go-git from the interface for last commit cache

Signed-off-by: Andrew Thornton <[email protected]>

* move cacheref to last_commit_cache

Signed-off-by: Andrew Thornton <[email protected]>

* Remove go-git from routers/private/hook

Signed-off-by: Andrew Thornton <[email protected]>

* Move FindLFSFiles to pipeline

Signed-off-by: Andrew Thornton <[email protected]>

* Make no-go-git variants

Signed-off-by: Andrew Thornton <[email protected]>

* Submodule RefID

Signed-off-by: Andrew Thornton <[email protected]>

* fix issue with GetCommitsInfo

Signed-off-by: Andrew Thornton <[email protected]>

* fix GetLastCommitForPaths

Signed-off-by: Andrew Thornton <[email protected]>

* Improve efficiency

Signed-off-by: Andrew Thornton <[email protected]>

* More efficiency

Signed-off-by: Andrew Thornton <[email protected]>

* even faster

Signed-off-by: Andrew Thornton <[email protected]>

* Reduce duplication

* As per @lunny

Signed-off-by: Andrew Thornton <[email protected]>

* attempt to fix drone

Signed-off-by: Andrew Thornton <[email protected]>

* fix test-tags

Signed-off-by: Andrew Thornton <[email protected]>

* default to use no-go-git variants and add gogit build tag

Signed-off-by: Andrew Thornton <[email protected]>

* placate lint

Signed-off-by: Andrew Thornton <[email protected]>

* as per @6543

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-12-17 22:00:47 +08:00
zeripath 74bd9691c6 Re-attempt to delete temporary upload if the file is locked by another process (#12447)
Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util.

Fix #12339

Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: silverwind <[email protected]>
2020-08-11 21:05:34 +01:00
John Olheiser baadb51445 Add gitea-vet (#10948)
* Add copyright

Signed-off-by: jolheiser <[email protected]>

* Add gitea-vet and fix non-compliance

Signed-off-by: jolheiser <[email protected]>

* Combine tools.go into build.go and clean up

Signed-off-by: jolheiser <[email protected]>

* Remove extra GO111MODULE=on

Signed-off-by: jolheiser <[email protected]>
2020-04-05 07:20:50 +01:00
zeripath 722a7c902d Add Close() method to gogitRepository (#8901)
In investigating #7947 it has become clear that the storage component of go-git repositories needs closing.

This PR adds this Close function and adds the Close functions as necessary.

In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files.

Fixes #7947
2019-11-13 07:01:19 +00:00
silverwind fe7689a6b2 Fix empty commits now showing in repo overview (#7521)
* Fix empty commits now showing in repo overview

* add test

* make fmt
2019-07-22 15:03:15 +03:00
Filip Navara 2af67f6044 Improve listing performance by using go-git (#6478)
* Use go-git for tree reading and commit info lookup.

Signed-off-by: Filip Navara <[email protected]>

* Use TreeEntry.IsRegular() instead of ObjectType that was removed.

Signed-off-by: Filip Navara <[email protected]>

* Use the treePath to optimize commit info search.

Signed-off-by: Filip Navara <[email protected]>

* Extract the latest commit at treePath along with the other commits.

Signed-off-by: Filip Navara <[email protected]>

* Fix listing commit info for a directory that was created in one commit and never modified after.

Signed-off-by: Filip Navara <[email protected]>

* Avoid nearly all external 'git' invocations when doing directory listing (.editorconfig code path is still hit).

Signed-off-by: Filip Navara <[email protected]>

* Use go-git for reading blobs.

Signed-off-by: Filip Navara <[email protected]>

* Make SHA1 type alias for plumbing.Hash in go-git.

Signed-off-by: Filip Navara <[email protected]>

* Make Signature type alias for object.Signature in go-git.

Signed-off-by: Filip Navara <[email protected]>

* Fix GetCommitsInfo for repository with only one commit.

Signed-off-by: Filip Navara <[email protected]>

* Fix PGP signature verification.

Signed-off-by: Filip Navara <[email protected]>

* Fix issues with walking commit graph across merges.

Signed-off-by: Filip Navara <[email protected]>

* Fix typo in condition.

Signed-off-by: Filip Navara <[email protected]>

* Speed up loading branch list by keeping the repository reference (and thus all the loaded packfile indexes).

Signed-off-by: Filip Navara <[email protected]>

* Fix lising submodules.

Signed-off-by: Filip Navara <[email protected]>

* Fix build

Signed-off-by: Filip Navara <[email protected]>

* Add back commit cache because of name-rev

Signed-off-by: Filip Navara <[email protected]>

* Fix tests

Signed-off-by: Filip Navara <[email protected]>

* Fix code style

* Fix spelling

* Address PR feedback

Signed-off-by: Filip Navara <[email protected]>

* Update vendor module list

Signed-off-by: Filip Navara <[email protected]>

* Fix getting trees by commit id

Signed-off-by: Filip Navara <[email protected]>

* Fix remaining unit test failures

* Fix GetTreeBySHA

* Avoid running `git name-rev` if not necessary

Signed-off-by: Filip Navara <[email protected]>

* Move Branch code to git module

* Clean up GPG signature verification and fix it for tagged commits

* Address PR feedback (import formatting, copyright headers)

* Make blob lookup by SHA working

* Update tests to use public API

* Allow getting content from any type of object through the blob interface

* Change test to actually expect the object content that is in the GIT repository

* Change one more test to actually expect the object content that is in the GIT repository

* Add comments
2019-04-19 20:17:27 +08:00
Lunny Xiao d578b71d61 move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364)
* move code.gitea.io/git to code.gitea.io/gitea/modules/git

* fix imports

* fix fmt

* fix misspell

* remove wrong tests data

* fix unit tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* enable Debug to trace the failure tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* comment commit count tests since git clone depth is 50

* fix tests

* update from code.gitea.io/git

* revert change to makefile
2019-03-27 17:33:00 +08:00