aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug of migrate comments which only fetch one page (#17055)Lunny Xiao2021-09-151-2/+7
| | | | | | | * Fix bug of migrate comments which only fetch one page * add next page to trace Co-authored-by: zeripath <art27@cantab.net>
* Do not show issue context popup on external issues (#17050)zeripath2021-09-153-4/+11
| | | | | | | | | The issues pop-up context cannot work for external issues - therefore do not show these. Fix #17047 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add doctor dbconsistency check for release and attachment (#16978)Lunny Xiao2021-09-141-0/+36
|
* Decrement Fork Num when converting from Fork (#17035)zeripath2021-09-141-0/+31
| | | | | | | | When converting repositories from forks to normal the root NumFork needs to be decremented too. Fix #17026 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Correctly rollback in ForkRepository (#17034)zeripath2021-09-141-16/+39
| | | | | | | | | | | | | The rollback functionality in services/repository/repository.go:ForkRepository is incorrect and could lead to a deadlock as it uses DeleteRepository to delete the rolled-back repository - a function which creates its own transaction. This PR adjusts the rollback function to only use RemoveAll as any database changes will be automatically rolled-back. It also handles panics and adjusts the Close within WithTx to ensure that if there is a panic the session will always be closed. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Support unprotected file patterns (#16395)Jimmy Praet2021-09-115-62/+92
| | | | | | | Fixes #16381 Note that changes to unprotected files via the web editor still cannot be pushed directly to the protected branch. I could easily add such support for edits and deletes if needed. But for adding, uploading or renaming unprotected files, it is not trivial. * Extract & Move GetAffectedFiles to modules/git
* Add skip and limit to git.GetTags (#16897)65432021-09-104-5/+17
| | | | * Make GetTags() api similar to GetBranches() * Use it for Tag/Release page
* Calculate label URL on API (#16186)65432021-09-102-6/+33
| | | close #8028
* Fix missing close in WalkGitLog (#17008)zeripath2021-09-101-7/+16
| | | | | | | | | | | | | | | | | | When the external context is cancelled it is possible for the GitLogReader to not itself be Closed. This PR does three things: 1. Instead of adding a plain defer it wraps the `g.Close` in a func as `g` may change. 2. It adds the missing explicit g.Close - although the defer fix makes this unnecessary. 3. It passes down the external context as the base context for the GitLogReader meaning that the cancellation of the external context will pass down automatically. Fix #17007 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use git attributes to determine generated and vendored status for language ↵zeripath2021-09-096-12/+640
| | | | | | | | | | | | | | | | stats and diffs (#16773) Replaces #16262 Replaces #16250 Replaces #14833 This PR first implements a `git check-attr` pipe reader - using `git check-attr --stdin -z --cached` - taking account of the change in the output format in git 1.8.5 and creates a helper function to read a tree into a temporary index file for that pipe reader. It then wires this in to the language stats helper and into the git diff generation. Files which are marked generated will be folded by default. Fixes #14786 Fixes #12653
* Enable Malayalam, Greek, Persian, Hungarian & Indonesian by default (#16998)65432021-09-091-2/+4
|
* Fix bug of migrated repository not index (#16991)Lunny Xiao2021-09-081-3/+2
| | | Fix #16986, #16152
* Make TestOneDevDownloadRepo work again & more resistant (#16987)65432021-09-081-12/+7
| | | | | * Update TestOneDevDownloadRepo since OneDev api changed * Use test functions for migrations
* Make mirror feature more configurable (#16957)65432021-09-073-19/+60
| | | | | | | | | | | Rename`[repository]` `DISABLE_MIRRORS` to `[mirror]` `DISABLE_NEW_PULL` and add `ENABLED` and `DISABLE_NEW_PUSH` with the below meanings: - `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors. - `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid. - `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
* Resolve TODO: Enable pagination on GiteaDownloader.GetComments() & update ↵65432021-09-062-41/+37
| | | | | | | another TODO (#16963) * Update TODO in migrations * Resolve TODO: enable pagination on GiteaDownloader.GetComments()
* Fix storage Iterate bug and Add storage doctor to delete garbage attachments ↵Lunny Xiao2021-09-062-2/+78
| | | | | | | (#16971) * Fix storage Iterate bug and Add storage doctor to delete garbage attachments * Close object when used
* Add missing icon set for `ActionRenameRepo` (#16972)a10121127962021-09-061-1/+1
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* Close storage objects before cleaning (#16934)zeripath2021-09-031-0/+1
| | | | | | | | | | | | Storage.Iterate provides the path and an open object. On windows using local storage means that the objects will be locked thus preventing clean from deleting them. This PR simply closes the objects early. Fix #16932 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use immediate queues in integration tests and ensure that immediate (#16927)zeripath2021-09-031-1/+1
| | | | | queue type is also used for unique queues. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Ignore review comment when ref commit is missed (#16905)Lunny Xiao2021-09-011-1/+2
|
* Gitlab Migrator: dont ignore reactions of last request (#16903)65432021-09-011-6/+12
| | | Fix bug related to early breaking when migrating reactions.
* Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899)65432021-08-311-4/+2
| | | | | | | * make sure headGitRepo is closed on err too * refactor * Fix git.Blob.DataAsync(): exec cancel since we already read all bytes (close pipe since we return a NopCloser)
* Remove ParseQueueConnStr as it is unused (#16878)zeripath2021-08-311-33/+0
| | | | | Remove ParseQueueConnStr as `modules/nosql` has taken over all of its functions. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix dump and restore respository (#16698)Lunny Xiao2021-08-303-2/+10
| | | | | | | | | | | * Fix dump and restore * return different error message for get commit * Fix missing delete release attachment when deleting repository * Fix ci and add some comments Co-authored-by: zeripath <art27@cantab.net>
* Timeout on flush in testing (#16864)zeripath2021-08-301-1/+12
| | | | | | | | | | | | | | | | | | | | * Timeout on flush in testing At the end of each test the queues are flushed. At present there is no limit on the length of time a flush can take which can lead to long flushes. However, if the CI task is cancelled we lose the log information as to where the long flush was taking place. This PR simply adds a default time limit of 2 minutes - at which point an error will be produced. This should allow us to more easily find the culprit. Signed-off-by: Andrew Thornton <art27@cantab.net> * return better error Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Paginate releases page & set default page size to 10 (#16857)Lunny Xiao2021-08-291-3/+6
| | | | | | | * Add release default page and set it to 10 * use limit Co-authored-by: 6543 <6543@obermui.de>
* Simplify split diff view generation and remove JS dependency (#16775)zeripath2021-08-291-0/+3
| | | | | | | | | | | Gitea has relied on some slow JS code to match up added and deleted lines on the diff pages. This can cause a considerable slow down on large diff pages. This PR makes a small change meaning that the matching up can occur much more simply. Partial fix #1351 Signed-off-by: Andrew Thornton <art27@cantab.net>
* In Render tolerate not being passed a context (#16842)zeripath2021-08-281-1/+7
| | | | | | | | | | | | | | | | | | | * In Render tolerate not being passed a context It is possible for RenderString to be passed to an external renderer if markdown is set to be rendered by an external renderer. No context is currently sent to these meaning that this will error out. Fix #16835 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add Context to Repo calls for RenderString All calls from routers can easily add the context - so add it. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Refactor the fork service slightly to take ForkRepoOptions (#16744)Kyle Evans2021-08-282-17/+21
| | | | | | | | | | | | | | | | | | | | * Refactor the fork service slightly to take ForkRepoOptions This reduces the number of places we need to change if we want to add other options during fork time. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Fix integrations and tests after ForkRepository refactor Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Update OldRepo -> BaseRepo Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * gofmt pass Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* Report the correct number of pushes on the feeds (#16811)zeripath2021-08-252-1/+14
| | | | | | | | | | | | | | | | * Report the correct number of pushes on the feeds Since the number of commits in the Action table has been limited to 5 the number of commits reported on the feeds page is now incorrectly also limited to 5. The correct number is available as the Len and this PR changes this to report this. Fix #16804 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update templates/user/dashboard/feeds.tmpl Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Prevent NPE on empty commit (#16812)zeripath2021-08-241-0/+3
|
* Add bundle download for repository (#14538)John Olheiser2021-08-2468-29/+130
| | | | | | | | | | | | | | | | | * Add bundle download Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix build tags Signed-off-by: jolheiser <john.olheiser@gmail.com> * Download specific commit Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Just use a slice when rendering file (#16774)zeripath2021-08-232-41/+39
| | | | | | Highlight currently uses a map which is memory inefficient. Switch to use a slice instead. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add migrate from OneDev (#16356)KN4CK3R2021-08-2220-92/+932
| | | | | | | | | | | | | | * Use context to simplify logic. * Added migration from OneDev. This PR adds [OneDev](https://code.onedev.io/) as migration source. Supported: - [x] Milestones - [x] Issues - [x] Pull Requests - [x] Comments - [x] Reviews - [x] Labels
* Return nil proxy function if proxy not enabled (#16742)zeripath2021-08-191-1/+3
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add proxy settings and support for migration and webhook (#16704)Lunny Xiao2021-08-1814-34/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add proxy settings and support for migration and webhook * Fix default value * Add newline for example ini * Add lfs proxy support * Fix lint * Follow @zeripath's review * Fix git clone * Fix test * missgin http requests for proxy * use empty Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Refactored and fixed migration tests. (#16714)KN4CK3R2021-08-1710-485/+744
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add API Token Cache (#16547)zeripath2021-08-171-0/+2
| | | | | | | | | | | | | | | | | One of the issues holding back performance of the API is the problem of hashing. Whilst banning BASIC authentication with passwords will help, the API Token scheme still requires a PBKDF2 hash - which means that heavy API use (using Tokens) can still cause enormous numbers of hash computations. A slight solution to this whilst we consider moving to using JWT based tokens and/or a session orientated solution is to simply cache the successful tokens. This has some security issues but this should be balanced by the security issues of load from hashing. Related #14668 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix spelling of HookProcReceiveResult (#16690)Lunny Xiao2021-08-141-7/+7
|
* Ensure empty lines are copiable and final new line too (#16678)zeripath2021-08-142-0/+116
| | | | | | | | | | | | * Ensure empty lines are copiable and final new line too When files are highlighted the newline character needs to be added in a whitespace compliant mode. Also ensure the final empty newline is rendered. Fix #16434 * Add test and ensure spans closed Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update issue_index to finish migration (#16685)65432021-08-131-0/+5
| | | | | * update issue_index to finish migration * One Func to RecalculateIssueIndexForRepo
* Fix NPE in fuzzer (#16680)zeripath2021-08-132-1/+17
| | | | | | | The fuzzer found an issue with the issue pattern processor where there is a spurious path.Clean which does not need to be there. This PR also sets the default AppURL for the fuzzer too. Signed-off-by: Andrew Thornton <art27@cantab.net>
* [API] generalize list header (#16551)65432021-08-125-17/+30
| | | | | | | | | | | | | * 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
* Add an api endpoint to fetch git notes (#15373) (#16649)nitul19912021-08-113-1/+32
| | | close #15373
* Rename ctx.Form() to ctx.FormString() and move code into own file (#16571)65432021-08-113-244/+31
| | | | | | | Followup from #16562 prepare for #16567 * Rename ctx.Form() to ctx.FormString() * Reimplement FormX func to need less code and cpu cycles * Move code into own file
* Upgrade github.com/google/go-github v32.1.0 -> v37.0.0 (#16661)65432021-08-102-157/+73
| | | | | * Upgrade github.com/google/go-github vv32.1.0 -> v37.0.0 * refactor: use GetX() func to reduce code
* Replace `list.List` with slices (#16311)KN4CK3R2021-08-098-87/+51
| | | | | | | | | | | | | | | | | | | * Replaced list with slice. * Fixed usage of pointer to temporary variable. * Replaced LIFO list with slice. * Lint * Removed type check. * Removed duplicated code. * Lint * Fixed merge. Co-authored-by: 6543 <6543@obermui.de>
* Change the implementation of the go-git version of GetNote to mirror the non ↵nitul19912021-08-092-0/+15
| | | | | | | go-git version when passed a non-existent commit (#16658) Fixes #16657
* Separate open and closed issue in metrics (#16637)Romain2021-08-071-0/+24
| | | | | | | * Get the issue counts in one query Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Allow setting X-FRAME-OPTIONS (#16643)zeripath2021-08-063-4/+6
| | | | | | | | | | | | | | | * Allow setting X-FRAME-OPTIONS This PR provides a mechanism to set the X-FRAME-OPTIONS header. Fix #7951 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>