aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repofiles
Commit message (Collapse)AuthorAgeFilesLines
* go-version constraints ignore pre-releases (#13234)zeripath2020-10-211-3/+3
| | | | | | | | | Go-version constraints ignore pre-releases. Rather than change the library further this PR simply changes the git version comparison to use simple version compare ignoring the issue of pre-releases. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Finally fix diff names (#13136)zeripath2020-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Finally fix diff names #12771 attempted to fix diff by avoiding the git diff line as it is possible to have an ambiguous line here. #12254 attempted to fix diff by assuming that names would quoted if they needed to be and if one was quoted then both would be. Both of these were wrong. I have now discovered `--src-prefix` and `--dst-prefix` which means that we can set this in such a way to force the git diff to always be unambiguous. Therefore this PR rollsback most of the changes in #12771 and uses these options to fix this. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update services/gitdiff/gitdiff.go * Update services/gitdiff/gitdiff.go * Update modules/repofiles/temp_repo.go * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* [Enhancement] Allow admin to merge pr with protected file changes (#12078)赵智超2020-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [Enhancement] Allow admin to merge pr with protected file changes As tilte, show protected message in diff page and merge box. Signed-off-by: a1012112796 <1012112796@qq.com> * remove unused ver * Update options/locale/locale_en-US.ini Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> * Add TrN * Apply suggestions from code review * fix lint * Update options/locale/locale_en-US.ini Co-authored-by: zeripath <art27@cantab.net> * Apply suggestions from code review * move pr proteced files check to TestPatch * Call TestPatch when protected branches settings changed * Apply review suggestion @CirnoT * move to service @lunny * slightly restructure routers/private/hook.go Adds a lot of comments and simplifies the logic Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * skip duplicate protected files check * fix check logic * slight refactor of TestPatch Signed-off-by: Andrew Thornton <art27@cantab.net> * When checking for protected files changes in TestPatch use the temporary repository Signed-off-by: Andrew Thornton <art27@cantab.net> * fix introduced issue with hook Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove the check on PR index being greater than 0 as it unnecessary Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add configurable Trust Models (#11712)zeripath2020-09-203-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add configurable Trust Models Gitea's default signature verification model differs from GitHub. GitHub uses signatures to verify that the committer is who they say they are - meaning that when GitHub makes a signed commit it must be the committer. The GitHub model prevents re-publishing of commits after revocation of a key and prevents re-signing of other people's commits to create a completely trusted repository signed by one key or a set of trusted keys. The default behaviour of Gitea in contrast is to always display the avatar and information related to a signature. This allows signatures to be decoupled from the committer. That being said, allowing arbitary users to present other peoples commits as theirs is not necessarily desired therefore we have a trust model whereby signatures from collaborators are marked trusted, signatures matching the commit line are marked untrusted and signatures that match a user in the db but not the committer line are marked unmatched. The problem with this model is that this conflicts with Github therefore we need to provide an option to allow users to choose the Github model should they wish to. Signed-off-by: Andrew Thornton <art27@cantab.net> * Adjust locale strings Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @6543 Co-authored-by: 6543 <6543@obermui.de> * Update models/gpg_key.go * Add migration for repository Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move all push update operations to a queue (#10133)Lunny Xiao2020-09-113-560/+0
| | | | | | | | | | | | | | | | | | | | * Fix test * Add no queue for test only * improve code * Auto watch whatever branch operation * Fix lint * Rename noqueue to immediate * Remove old PushUpdate function * Fix tests Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* LFS support to be stored on minio (#12518)Lunny Xiao2020-09-082-4/+14
| | | | | | | | | | | | | | | | | * LFS support to be stored on minio * Fix test * Fix lint * Fix lint * Fix check * Fix test * Update documents and add migration for LFS * Fix some bugs
* [Vendor] Switch go-version lib (#12719)65432020-09-051-7/+5
| | | | | | | | | | | | | | | | | | | | | * vendor: switch from "mcuadros/go-version" to "hashicorp/go-version" * Adapt P1 * simplify * fix lint * adapt * fix lint & rm old code * no deadlock * rm RWMutex and check GoVersion only 1-time * Copyright header Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add spent time to referenced issue in commit message (#12220)Lauris BH2020-09-041-0/+72
|
* Detect full references to issues and pulls in commit messages (#12399)zeripath2020-08-061-0/+78
| | | | | Fix #10269 Signed-off-by: Andrew Thornton <art27@cantab.net>
* prefer NoError/Error over Nil/NotNil (#12271)Stephen Solka2020-07-195-11/+11
|
* Server-side syntax highlighting for all code (#12047)mrsdizzie2020-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Server-side syntax hilighting for all code This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes #7729 Fixes #10157 Fixes #11825 Fixes #7728 Fixes #3872 Fixes #3682 And perhaps gets closer to #9553 * fix line marker * fix repo search * Fix single line select * properly load settings * npm uninstall highlight.js * review suggestion * code review * forgot to call function * fix test * Apply suggestions from code review suggestions from @silverwind thanks Co-authored-by: silverwind <me@silverwind.io> * code review * copy/paste error * Use const for highlight size limit * Update web_src/less/_repository.less Co-authored-by: Lauris BH <lauris@nix.lv> * update size limit to 1MB and other styling tweaks * fix highlighting for certain diff sections * fix test * add worker back as suggested Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use only first line of commit when creating referenced comment (#11960)Cirno the Strongest2020-06-191-1/+2
| | | | | | | | | | * Use only first line of commit when creating referenced comment * Update modules/repofiles/action.go * Display first line only on feeds too Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
* Fix numbr of files, total additions, and deletions (#11614)zeripath2020-05-262-0/+6
| | | | | Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Revert "Avoid 0 new commits messages to be send (#11082)" (#11397)zeripath2020-05-131-1/+7
| | | This reverts commit 6034f8bcaaa5348fee775d2307ff03162130a088.
* Fix GetContents(): Dont't ignore Executables (#11192)65432020-04-241-1/+1
| | | | | | | * Refactor: dont expose help functions * repofiles GetContents: dont ignore executables * CI.restart()
* Avoid 0 new commits messages to be send (#11082)Cornel2020-04-181-7/+1
| | | Fixes #10498
* Handle push rejection in branch and upload (#10854)zeripath2020-03-282-22/+14
| | | | | | | | | | | | | * Handle push rejections and push out-of-date in branch creation and file upload. * Remove the duplicated sanitize from services/pull/merge * Move the errors Err(Merge)PushOutOfDate and ErrPushRejected to modules/git * Handle errors better in the upload file dialogs Fix #10460 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Allow to set protected file patterns that can not be changed under no ↵Lauris BH2020-03-272-22/+42
| | | | | conditions (#10806) Co-Authored-By: zeripath <art27@cantab.net>
* Check for tag, not just new tag (#10663)John Olheiser2020-03-081-1/+1
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Ensure executable bit is kept on the web editor (#10607)Antoine GIRARD2020-03-051-2/+10
| | | | Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Handle push rejection message in Merge & Web Editor (#10373)zeripath2020-02-221-2/+22
| | | | | | | | | | | | | | | | | | * Handle push rejection message in Merge * placate golangci-lint * Fix sanitize, adjust message handling * oops * Oops * Handle push-rejection in webeditor CRUD too * Apply suggestions from code review Co-authored-by: Lauris BH <lauris@nix.lv>
* Move PushUpdateAddDeleteTags to repository module from models (#10106)Lunny Xiao2020-02-031-1/+1
| | | | | | * Move PushUpdateAddDeleteTags to repository module from models * Fix deadlock on sqlite
* Improve push update options (#10105)Lunny Xiao2020-02-023-143/+187
| | | | | | | | | | | | | | * Improve push update options * fix test * More refactor and fix lint * fix lint * Fix lint Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix pull view when head repository or head branch missed and close related ↵Lunny Xiao2020-01-251-5/+17
| | | | | | | | | | | | | | | | | | pull requests when delete head repository or head branch (#9927) * fix pull view when head repository or head branch missed and close related pull requests when delete branch * fix pull view broken when head repository deleted * close pull requests when head repositories deleted * Add tests for broken pull request head repository or branch * fix typo * ignore special error when close pull request Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix wrong permissions check when issues/prs shared operations (#9885)Lunny Xiao2020-01-201-2/+2
| | | | | | | | | | | * Fix wrong permissions check when issues/prs shared operations * move redirect to the last of the function * fix swagger Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Give the stdout on temp_repo error (#9871)zeripath2020-01-201-3/+3
| | | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add require signed commit for protected branch (#9708)zeripath2020-01-153-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add require signed commit for protected branch * Fix fmt * Make editor show if they will be signed * bugfix * Add basic merge check and better information for CRUD * linting comment * Add descriptors to merge signing * Slight refactor * Slight improvement to appearances * Handle Merge API * manage CRUD API * Move error to error.go * Remove fix to delete.go * prep for merge * need to tolerate \r\n in message * check protected branch before trying to load it * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * fix commit-reader Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Fix #9752 (#9769)zeripath2020-01-141-1/+1
|
* Move newbranch to standalone package (#9627)Lunny Xiao2020-01-142-10/+11
| | | | | | | | | | | | * Move newbranch to standalone package * move branch functions to modules to avoid dependencies cycles * fix tests * fix lint * fix lint
* Move create/fork repository from models to modules/repository (#9489)Lunny Xiao2020-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | * 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
* Don't attempt to close issue if already closed (#9696)guillep2k2020-01-111-3/+5
| | | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Move push commits from models to modules/repository (#9370)Lunny Xiao2020-01-103-20/+23
| | | | | | | | | | | | | | | | * Move push commits from models to modules/repository * fix test * fix test * fix test * fix test * fix test Co-authored-by: zeripath <art27@cantab.net>
* Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532)David Svantesson2020-01-091-2/+2
| | | | | | | Fix #5997. If a push causes the patch/diff of a PR towards target branch to change, all existing reviews for the PR will be set and shown as stale. New branch protection option to dismiss stale approvals are added. To show that a review is not based on the latest PR changes, an hourglass is shown
* Fix deleted branch isn't removed when push the branch again (#9516)Lunny Xiao2019-12-271-0/+6
|
* Batch hook pre- and post-receive calls (#8602)zeripath2019-12-263-114/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * make notifyWatchers work on multiple actions * more efficient multiple notifyWatchers * Make CommitRepoAction take advantage of multiple actions * Batch post and pre-receive results * Set batch to 30 * Auto adjust timeout & add logging * adjust processing message * Add some messages to pre-receive * Make any non-200 status code from pre-receive an error * Add missing hookPrintResults * Remove shortcut for single action * mistaken merge fix * oops * Move master branch to the front * If repo was empty and the master branch is pushed ensure that that is set as the default branch * fixup * fixup * Missed HookOptions in setdefaultbranch * Batch PushUpdateAddTag and PushUpdateDelTag Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [API] Extend contents with dates (#9464)65432019-12-243-5/+28
| | | | | | | | | | | | | | | * extend CommitTree func * make sure Date NOT nil * spell corection Co-Authored-By: zeripath <art27@cantab.net> * add TEST Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* fixed bug in GitTreeBySHA where pulling items from a page other than page 1 ↵Brad Albright2019-12-221-5/+5
| | | | would fail because the wrong var was used to set the entries to return (#9459)
* Refactor comment (#9330)Lunny Xiao2019-12-151-2/+5
| | | | | | | | * Refactor comment * fix test * improve code
* File Edit: Author/Committer interchanged [BugFix] (#9297)65432019-12-093-3/+3
| | | | | | | | | * simple fix * fix test too * repair more twists use same sequence: first Author, then Commiter
* Move code indexer related code to a new package (#9191)Lunny Xiao2019-12-081-4/+0
| | | | | | | | | | | | * move code indexer related code to a new package * fix lint * fix tests * fix fmt * GetMaxID support interface parameter
* Move UpdateIssuesCommit from models to repofiles (#9276)Lunny Xiao2019-12-072-1/+333
|
* Move PushUpdateOptions from models to repofiles (#9124)Lunny Xiao2019-11-291-1/+12
|
* Expand/Collapse Files and Blob Excerpt while Reviewing/Comparing code (#8924)Benno2019-11-151-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * update #8659 fold/unfold code diffs * add fold button style * update #8659 implement expand up/down codes (blob excerpt) * fix golint errors * fix expand direction * remove debug message * update css style for blob exceprt * fix typo in comment * update style sheet with less * update expect diff (add SectionInfo) * update #8942 accept suggested change (fix typo) * close reader and check file type before get tail section * adjust button position and check file type before insert fold button * move index js to web_src * merge index.js with master * generate index.js * update js coding style
* Add Close() method to gogitRepository (#8901)zeripath2019-11-1312-0/+33
| | | | | | | | | 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
* Migrate temp_repo.go to use git.NewCommand (#8918)zeripath2019-11-111-163/+82
| | | | | | | This PR migrates temp_repo.go to use git.NewCommand instead creating processes by itself - this fixes the problem underlying PR #8905. There are other places that run git outside of the controlled locale defined in #8548 but temp_repo.go is the only cause of failure of local testing in cases where English is not the default - implying that error messages from those other commands are not interpreted. Replaces #8905
* Auto-subscribe user to repository when they commit/tag to it (#7657)guillep2k2019-11-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add support for AUTO_WATCH_ON_CHANGES and AUTO_WATCH_ON_CLONE * Update models/repo_watch.go Co-Authored-By: Lauris BH <lauris@nix.lv> * Round up changes suggested by lafriks * Added changes suggested from automated tests * Updated deleteUser to take RepoWatchModeDont into account, corrected inverted DefaultWatchOnClone and DefaultWatchOnChanges behaviour, updated and added tests. * Reinsert import "github.com/Unknwon/com" on http.go * Add migration for new column `watch`.`mode` * Remove serv code * Remove WATCH_ON_CLONE; use hooks, add integrations * Renamed watch_test.go to repo_watch_test.go * Correct fmt * Add missing EOL * Correct name of test function * Reword cheat and ini descriptions * Add update to migration to ensure column value * Clarify comment Co-Authored-By: zeripath <art27@cantab.net> * Simplify if condition
* Move repofiles webhooks to notification (#8807)Lunny Xiao2019-11-061-67/+7
|
* Move push commits events to notification (#8783)Lunny Xiao2019-11-031-16/+2
| | | | | | | | * Move push commits events to notification * Update modules/notification/base/null.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Prevent upload (overwrite) of lfs locked file (#8769)David Svantesson2019-11-021-7/+17
| | | | | | | | | | | | * Check if file is locked on upload file commit. * Better user message if file is locked. * Check lfs lock before creating temporary repository. fix some errors. * move lines * Add comment that enabled setting is checked.
* Rename HookQueue to hookQueue (#8778)Lunny Xiao2019-11-021-4/+0
| | | | | | * Rename HookQueue to hookQueue * fix lint