Lunny Xiao
76aa33d884
Move init repository related functions to modules ( #19159 )
...
* Move init repository related functions to modules
* Fix lint
* Use ctx but db.DefaultContext
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years ago
Abheek Dhawan
f316582458
Set the default branch for repositories generated from templates ( #19136 )
...
* Set the default branch for repositories generated from templates
* Allows default branch to be set through the API for repos generated from templates
* Update swagger API template
* Only set default branch to the one from the template if not specified
* Use specified default branch if it exists while generating git commits
Fix #19082
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
Lunny Xiao
5723240490
Some repository refactors ( #17950 )
...
* some repository refactors
* remove unnecessary code
* Fix test
* Remove unnecessary banner
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
33fca2b537
Move webhook into models/webhook/ ( #17579 )
3 years ago
Lunny Xiao
5842a55b31
Move login related structs and functions to models/login ( #17093 )
...
* Move login related structs and functions to models/login
* Fix test
* Fix lint
* Fix lint
* Fix lint of windows
* Fix lint
* Fix test
* Fix test
* Only load necessary fixtures when preparing unit tests envs
* Fix lint
* Fix test
* Fix test
* Fix error log
* Fix error log
* Fix error log
* remove unnecessary change
* fix error log
* merge main branch
3 years ago
zeripath
9302eba971
DBContext is just a Context ( #17100 )
...
* DBContext is just a Context
This PR removes some of the specialness from the DBContext and makes it context
This allows us to simplify the GetEngine code to wrap around any context in future
and means that we can change our loadRepo(e Engine) functions to simply take contexts.
Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix unit tests
Signed-off-by: Andrew Thornton <art27@cantab.net>
* another place that needs to set the initial context
Signed-off-by: Andrew Thornton <art27@cantab.net>
* avoid race
Signed-off-by: Andrew Thornton <art27@cantab.net>
* change attachment error
Signed-off-by: Andrew Thornton <art27@cantab.net>
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
6543
2289580bb7
[API] generalize list header ( #16551 )
...
* Add info about list endpoints to CONTRIBUTING.md
* Let all list endpoints return X-Total-Count header
* Add TODOs for GetCombinedCommitStatusByRef
* Fix models/issue_stopwatch.go
* Rrefactor models.ListDeployKeys
* Introduce helper func and use them for SetLinkHeader related func
3 years ago
Lunny Xiao
9d99f6ab19
Refactor renders ( #15175 )
...
* Refactor renders
* Some performance optimization
* Fix comment
* Transform reader
* Fix csv test
* Fix test
* Fix tests
* Improve optimaziation
* Fix test
* Fix test
* Detect file encoding with reader
* Improve optimaziation
* reduce memory usage
* improve code
* fix build
* Fix test
* Fix for go1.15
* Fix render
* Fix comment
* Fix lint
* Fix test
* Don't use NormalEOF when unnecessary
* revert change on util.go
* Apply suggestions from code review
Co-authored-by: zeripath <art27@cantab.net>
* rename function
* Take NormalEOF back
Co-authored-by: zeripath <art27@cantab.net>
4 years ago
Lunny Xiao
6edfa6bc88
Fix broken migration on webhook ( #13911 )
...
* Fix broken migration on webhook
* Fix lint
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
4 years ago
Lunny Xiao
80a6b0f5bc
Avatars and Repo avatars support storing in minio ( #12516 )
...
* Avatar support minio
* Support repo avatar minio storage
* Add missing migration
* Fix bug
* Fix test
* Add test for minio store type on avatars and repo avatars; Add documents
* Fix bug
* Fix bug
* Add back missed avatar link method
* refactor codes
* Simplify the codes
* Code improvements
* Fix lint
* Fix test mysql
* Fix test mysql
* Fix test mysql
* Fix settings
* Fix test
* fix test
* Fix bug
4 years ago
SpaWn2KiLl
1f01f53c53
API add/generalize pagination ( #9452 )
...
* paginate results
* fixed deadlock
* prevented breaking change
* updated swagger
* go fmt
* fixed find topic
* go mod tidy
* go mod vendor with go1.13.5
* fixed repo find topics
* fixed unit test
* added Limit method to Engine struct; use engine variable when provided; fixed gitignore
* use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors
* set Page value on Home route
* improved memory allocations
* fixed response headers
* removed logfiles
* fixed import order
* import order
* improved swagger
* added function to get models.ListOptions from context
* removed pagesize diff on unit test
* fixed imports
* removed unnecessary struct field
* fixed go fmt
* scoped PR
* code improvements
* code improvements
* go mod tidy
* fixed import order
* fixed commit statuses session
* fixed files headers
* fixed headers; added pagination for notifications
* go mod tidy
* go fmt
* removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list
* Apply suggestions from code review
Co-Authored-By: 6543 <6543@obermui.de>
Co-Authored-By: zeripath <art27@cantab.net>
* fixed build error
* CI.restart()
* fixed merge conflicts resolve
* fixed conflicts resolve
* improved FindTrackedTimesOptions.ToOptions() method
* added backwards compatibility on ListReleases request; fixed issue tracked time ToSession
* fixed build error; fixed swagger template
* fixed swagger template
* fixed ListReleases backwards compatibility
* added page to user search route
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
5 years ago
Lunny Xiao
b465d0d787
Move create/fork repository from models to modules/repository ( #9489 )
...
* Move create/fork repository from models to modules/repository
* fix wrong reference
* fix test
* fix test
* fix lint
* Fix DBContext
* remove duplicated TestMain
* fix lint
* fix conflicts
5 years ago
Lunny Xiao
5765212c6d
Add owner_name column for table repository for maintaince reason ( #9717 )
...
* Add owner_name column for table repository for maintaince reason
* refactor
* Fix tests
* fix test
* fix bug when fork repository
Co-authored-by: zeripath <art27@cantab.net>
5 years ago
John Olheiser
ee9ce0cfa9
Fix nil reference in repo generation ( #9660 )
...
* Fix nil reference
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Tighten
Signed-off-by: jolheiser <john.olheiser@gmail.com>
5 years ago
zeripath
4acca9d2e8
Properly enforce gitea environment for pushes ( #9501 )
...
#8982 attempted to enforce the gitea environment for pushes - unfortunately it tested the settings before they were actually read in - and therefore does not do that!
5 years ago
Lunny Xiao
59d6401486
Use ioutil.TmpDir for new created temp directory ( #9368 )
...
* Use os.TmpDir for new created temp directory
* fix error message
5 years ago
zeripath
60c5339042
Graceful: Cancel Process on monitor pages & HammerTime ( #9213 )
...
* Graceful: Create callbacks to with contexts
* Graceful: Say when Gitea is completely finished
* Graceful: Git and Process within HammerTime
Force all git commands to terminate at HammerTime
Force all process commands to terminate at HammerTime
Move almost all git processes to run as git Commands
* Graceful: Always Hammer after Shutdown
* ProcessManager: Add cancel functionality
* Fix tests
* Make sure that process.Manager.Kill() cancels
* Make threadsafe access to Processes and remove own unused Kill
* Remove cmd from the process manager as it is no longer used
* the default context is the correct context
* get rid of double till
5 years ago
John Olheiser
15a5c10d33
Variable expansion in repository templates ( #9163 )
...
* Start expansion
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* _template rather than .template
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Use ioutil
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add descriptions to mapping
* Start globbing
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Tune globbing
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Re-arrange imports
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Don't expand git hooks
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add glob tests for .giteatemplate
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Parse globs separately so they can be tested more easily
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Change template location and add docs
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* nit
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update docs/content/doc/features/gitea-directory.md
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Update docs/content/doc/features/gitea-directory.md
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Add upper-lower case match
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Nits
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update models/repo_generate.go
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
John Olheiser
62bcb2b7f1
Add avatar and issue labels to template repositories ( #9149 )
...
* Add avatar and issue labels
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix redundant if-err
Signed-off-by: jolheiser <john.olheiser@gmail.com>
5 years ago
John Olheiser
e84326aaec
Add git hooks and webhooks to template repositories; move to services ( #8926 )
...
* Add git hooks and webhooks to template options
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update models/repo.go
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Add tooltip if the user can't edit git hooks
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Close repositories after copying git hooks
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Wording
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Restructure for services
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Return errors
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move GenerateRepository to using a DBContext
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Wrap with models.WithTx
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Remove debug print
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move if-error-delete-repo outside WithTx
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Return nil if no repo generated
Signed-off-by: jolheiser <john.olheiser@gmail.com>
5 years ago