Lunny Xiao
fd7d83ace6
Move almost all functions' parameter db.Engine to context.Context ( #19748 )
...
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
2 years ago
Lunny Xiao
b8911fb456
Use a struct as test options ( #19393 )
...
* Use a struct as test options
* Fix name
* Fix test
3 years ago
6543
3e88af898a
Make git.OpenRepository accept Context ( #19260 )
...
* OpenRepositoryCtx -> OpenRepository
* OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
3 years ago
6543
54e9ee37a7
format with gofumpt ( #18184 )
...
* gofumpt -w -l .
* gofumpt -w -l -extra .
* Add linter
* manual fix
* change make fmt
3 years ago
zeripath
5cb0c9aa0d
Propagate context and ensure git commands run in request context ( #17868 )
...
This PR continues the work in #17125 by progressively ensuring that git
commands run within the request context.
This now means that the if there is a git repo already open in the context it will be used instead of reopening it.
Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
Lunny Xiao
719bddcd76
Move repository model into models/repo ( #17933 )
...
* Some refactors related repository model
* Move more methods out of repository
* Move repository into models/repo
* Fix test
* Fix test
* some improvements
* Remove unnecessary function
3 years ago
Lunny Xiao
a666829a37
Move user related model into models/user ( #17781 )
...
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
3 years ago
Lunny Xiao
fc3d082609
Move attachment into models/repo/ ( #17650 )
...
* Move attachment into models/repo/
* Fix test
* Fix bug
3 years ago
wxiaoguang
81926d61db
Decouple unit test, remove intermediate `unittestbridge` package ( #17662 )
...
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago
wxiaoguang
df64fa4865
Decouple unit test code from business code ( #17623 )
3 years ago
Lunny Xiao
a4bfef265d
Move db related basic functions to models/db ( #17075 )
...
* Move db related basic functions to models/db
* Fix lint
* Fix lint
* Fix test
* Fix lint
* Fix lint
* revert unnecessary change
* Fix test
* Fix wrong replace string
* Use *Context
* Correct committer spelling and fix wrong replaced words
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
Lunny Xiao
ddc709ff7f
Add repo_id for attachment ( #16958 )
...
When create a new issue or comment and paste/upload an attachment/image, it will not assign an issue id before submit. So if user give up the creating, the attachments will lost key feature and become dirty content. We don't know if we need to delete the attachment even if the repository deleted.
This PR add a repo_id in attachment table so that even if a new upload attachment with no issue_id or release_id but should have repo_id. When deleting a repository, they could also be deleted.
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
KN4CK3R
44b8b07631
Add tag protection ( #15629 )
...
* Added tag protection in hook.
* Prevent UI tag creation if protected.
* Added settings page.
* Added tests.
* Added suggestions.
* Moved tests.
* Use individual errors.
* Removed unneeded methods.
* Switched delete selector.
* Changed method names.
* No reason to be unique.
* Allow editing of protected tags.
* Removed unique key from migration.
* Added docs page.
* Changed date.
* Respond with 404 to not found tags.
* Replaced glob with regex pattern.
* Added support for glob and regex pattern.
* Updated documentation.
* Changed white* to allow*.
* Fixed edit button link.
* Added cancel button.
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago
KN4CK3R
3607f79d78
Fixed assert statements. ( #16089 )
3 years ago
Lunny Xiao
8567cba0d9
Implement delete release attachments and update release attachments' name ( #14130 )
...
* Implement delete release attachment
* Add attachments on release edit page
* Fix bug
* Finish del release attachments
* Fix frontend lint
* Fix tests
* Support edit release attachments
* Added tests
* Remove the unnecessary parameter isCreate from UpdateReleaseOrCreatReleaseFromTag
* Rename UpdateReleaseOrCreatReleaseFromTag to UpdateRelease
* Fix middle align
4 years ago
a1012112796
83cf1a894e
Create tag on ui ( #13467 )
...
Support create single tag directly
support create tag with message from create release ui
Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
4 years ago
赵智超
1f12dc8e88
Add action feed for new release ( #12324 )
...
* Add action feed for new release
Signed-off-by: a1012112796 <1012112796@qq.com>
* fix lint
* Apply suggestions from code review
* Add ReleaseID to the action table
* Remove error message
* Fold the attachments download list
* remove attchment download list
* simplify code
* fix create release from existing tag
* simplify ui
* translation change
* fix test
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
Richard Mahn
8a36c46a7e
Fixes #12341 : Release date should only be set to current time if draft or tag created ( #12343 )
...
* Fixes #12341 : Release date should only be set to current time if draft or tag created
* Removes old date set
* Adds unit tests
* make fmt
* Fixes tests
* Adds sleep for comparing times
* Adds sleep for comparing times
* Fixes tests
Co-authored-by: Matti R <matti@mdranta.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
4 years ago
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
5 years ago
Lunny Xiao
7ff783b732
Move mirror to a standalone package from models ( #7486 )
...
* move mirror to a standalone package
* fix mirror address in template
* fix tests
* fix lint
* fix comment
* fix tests
* fix tests
* fix vendor
* fix fmt
* fix lint
* remove wrong file submitted
* fix conflict
* remove unrelated changes
* fix go mod
* fix tests
* clean go mod
* make vendor work
* make vendor work
* fix tests
* remove duplicated test
5 years ago
Lunny Xiao
3249c0ccba
Extract actions on deletereleasebyid from models to release service ( #8219 )
...
* extract actions on deletereleasebyid from models to release service
* fix tests
5 years ago
Lunny Xiao
4959bf1c09
Move create release from models to a standalone package ( #7539 )
...
* move create release from models to a standalone package
* fix lint
* fix comment year
* fix lint
* fix lint
* fix package import name
* fix vendor
* fix go mod
* some refactors
* fix vendor
* use go1.12 make vendor
* fix vendor
5 years ago
Christian Muehlhaeuser
5e4e7d3df0
Added missing error checks in tests ( #7554 )
...
Whenever we assign a value to err, check for it being nil.
5 years ago
Lunny Xiao
e728b55812
Fix bug conflict between SyncReleasesWithTags and InsertReleases ( #7337 )
...
* fix bug conflict between SyncReleasesWithTags and InsertReleases
* fix tests
* fix fmt
5 years ago
Lunny Xiao
08069dc465
Improve migrations to support migrating milestones/labels/issues/comments/pullrequests ( #6290 )
...
* add migrations
* fix package dependency
* fix lints
* implements migrations except pull requests
* add releases
* migrating releases
* fix bug
* fix lint
* fix migrate releases
* fix tests
* add rollback
* pull request migtations
* fix import
* fix go module vendor
* add tests for upload to gitea
* more migrate options
* fix swagger-check
* fix misspell
* add options on migration UI
* fix log error
* improve UI options on migrating
* add support for username password when migrating from github
* fix tests
* remove comments and fix migrate limitation
* improve error handles
* migrate API will also support migrate milestones/labels/issues/pulls/releases
* fix tests and remove unused codes
* add DownloaderFactory and docs about how to create a new Downloader
* fix misspell
* fix migration docs
* Add hints about migrate options on migration page
* fix tests
6 years ago
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
6 years ago
Harshit Bansal
63bd1b9203
mirror: Delete tags in mirror which are removed for original repo. ( #5609 )
...
This bug was being caused by an error in the logic in `release.go`.
Credit to @yasuokav for tracing the root of the issue.
Fixes : #5192 .
6 years ago
Lunny Xiao
970c690681
fix release creation via API ( #5076 )
...
* fix release creation via API
* fix release create tests
6 years ago