summaryrefslogtreecommitdiffstats
path: root/cmd
Commit message (Collapse)AuthorAgeFilesLines
* Add a new command doctor to check if some wrong configurations on gitea ↵Lunny Xiao2020-01-111-0/+130
| | | | | | | | | | | | | | instance (#9095) * add doctor * Add a new command doctor to check if some wrong configurations on gitea instance * fix import * use regex match authorized_keys on doctor * Add documentation
* Fix #9530: admin auth list make readable and admin auth delete bug fix (#9628)Shashvat Kedia2020-01-071-2/+3
|
* Properly enforce gitea environment for pushes (#9501)zeripath2019-12-271-4/+12
| | | #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!
* Remove unnecessary loading of settings in update hook (#9496)zeripath2019-12-271-12/+1
| | | This PR simply makes update an empty command rather than needlessly load the settings for each reference.
* Batch hook pre- and post-receive calls (#8602)zeripath2019-12-261-43/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add debug option to serv to help debug problems (#9492)zeripath2019-12-253-7/+15
| | | | | | * Add debug option to serv to help debug problems * fixup! Add debug option to serv to help debug problems
* Fixed errors logging in dump.go (#9218)Rychu2019-12-171-26/+32
| | | | | | | | | | | | * Fixed errors logging in dump.go * Replaced overlooked log.Fatal() with fatal() * Run make fmt on dump.go * Added missing new line to the fatal log * Run make fmt on dump.go
* AuthorizedKeysCommand should not query db directly (#9371)zeripath2019-12-161-6/+4
| | | | | | | | * AuthorizedKeysCommand should not query db directly * Update routers/private/internal.go * Fix import order
* Graceful: Xorm, RepoIndexer, Cron and Others (#9282)zeripath2019-12-153-6/+12
| | | | | | | | | | | | * Change graceful to use a singleton obtained through GetManager instead of a global. * Graceful: Make TestPullRequests shutdownable * Graceful: Make the cron tasks graceful * Graceful: AddTestPullRequest run in graceful ctx * Graceful: SyncMirrors shutdown * Graceful: SetDefaultContext for Xorm to be HammerContext * Avoid starting graceful for migrate commands and checkout * Graceful: DeliverHooks now can be shutdown * Fix multiple syncing errors in modules/sync/UniqueQueue & Make UniqueQueue closable * Begin the process of making the repo indexer shutdown gracefully
* Move some repository methods from models to modules/repository (#9353)Lunny Xiao2019-12-141-1/+2
| | | | | | * Move some repository methods from models to modules/repository * fix test
* FCGI: Allow FCGI over unix sockets (#9298)zeripath2019-12-102-4/+8
| | | | | | * FCGI: Allow FCGI over unix sockets * fixup! FCGI: Allow FCGI over unix sockets
* Graceful: Cancel Process on monitor pages & HammerTime (#9213)zeripath2019-11-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Graceful: Allow graceful restart for fcgi (#9112)zeripath2019-11-242-16/+18
| | | | | | | | | * Graceful: Allow graceful restart for fcgi My previous interpretation was incorrect - we do not handle sockets being passed in over stdin * Update web.go
* Graceful: Allow graceful restart for unix sockets (#9113)zeripath2019-11-242-29/+12
| | | | Previously we could not handle graceful restarts for http over unix sockets. These can now be handled.
* Add Graceful shutdown for Windows and hooks for shutdown of goroutines (#8964)zeripath2019-11-213-42/+4
| | | | | | | | | | | | | | | | | | * Graceful Shutdown for windows and others Restructures modules/graceful, adding shutdown for windows, removing and replacing the old minwinsvc code. Creates a new waitGroup - terminate which allows for goroutines to finish up after the shutdown of the servers. Shutdown and terminate hooks are added for goroutines. * Remove unused functions - these can be added in a different PR * Add startup timeout functionality * Document STARTUP_TIMEOUT
* Enforce Gitea environment for pushes (#8982)zeripath2019-11-141-3/+22
| | | | | | | | * Enforce Gitea environment for pushes * Update custom/conf/app.ini.sample Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com>
* Add Close() method to gogitRepository (#8901)zeripath2019-11-131-0/+3
| | | | | | | | | 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
* Adjust the must-change-password help (#8755)zeripath2019-10-301-1/+1
|
* Graceful fixes (#8645)zeripath2019-10-231-0/+2
| | | | | | | | | | * Only attempt to kill parent once * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Add waitgroup for running servers
* Allow Protected Branches to Whitelist Deploy Keys (#8483)zeripath2019-10-212-0/+4
| | | | | | | | | | | | | | | Add an option to protected branches to add writing deploy keys to the whitelist for pushing. Please note this is technically a breaking change: previously if the owner of a repository was on the whitelist then any writing deploy key was effectively on the whitelist. This option will now need to be set if that is desired. Closes #8472 Details: * Allow Protected Branches to Whitelist Deploy Keys * Add migration * Ensure that IsDeployKey is set to false on the http pushes * add not null default false
* Restore Graceful Restarting & Socket Activation (#7274)zeripath2019-10-153-35/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prevent deadlock in indexer initialisation during graceful restart * Move from gracehttp to our own service to add graceful ssh * Add timeout for start of indexers and make hammer time configurable * Fix issue with re-initialization in indexer during tests * move the code to detect use of closed to graceful * Handle logs gracefully - add a pid suffix just before restart * Move to using a cond and a holder for indexers * use time.Since * Add some comments and attribution * update modules.txt * Use zero to disable timeout * Move RestartProcess to its own file * Add cleanup routine
* Password Complexity Checks (#6230)Maxim Tkachenko2019-10-141-9/+10
| | | | | | | | | Add password complexity checks. The default settings require a lowercase, uppercase, number and a special character within passwords. Co-Authored-By: T-M-A <maxim.tkachenko@gmail.com> Co-Authored-By: Lanre Adelowo <adelowomailbox@gmail.com> Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-Authored-By: Lauris BH <lauris@nix.lv>
* Move database settings from models to setting (#7806)Lunny Xiao2019-08-244-7/+6
| | | | | | | | | | | | | | | | | | * move database settings from models to setting * update docs * fix checkout pr * fix tests * fix lint * remove unsupported tidb options * correct wrong variable name * remove tidb totally
* Use gitea forked macaron (#7933)Tamal Saha2019-08-233-4/+4
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* Attempt to fix hook problem (#7854)zeripath2019-08-141-0/+1
|
* Update serv.go (#7822)clavinet2019-08-111-1/+1
| | | | small semantics fix "Hi there, user!" looks better than "Hi there: user!"
* cmd/serv: actually exit after fatal errors (#7458)Allen Wild2019-07-131-1/+0
| | | | | | | | | | | | | | | | Regression in 356854fc5f8d7d1a7e4d68c9e00929e9ce8aa867, where a log.Fatal call was removed. log.Fatal calls os.Exit(1) as intended, but without it the fail() function returns normally and execution continues past the fatal error, causing a panic. This is visible as a go panic log and stack trace returned to the SSH client, which is not only ugly, it leaks server and build system information. Fix by removing the stray return statement so that the fail() function always calls os.Exit(1). Fixes: https://github.com/go-gitea/gitea/issues/7457 Signed-off-by: Allen Wild <allenwild93@gmail.com>
* #6946 Run hooks on merge/edit and cope with protected branches (#6961)zeripath2019-07-012-2/+3
| | | | | | | | | | | | | | | | | | * Fix #6946 by checking PullRequest ID on pushing * Ensure we have the owner name, the pr attributes and the the issue * Fix TestSearchRepo by waiting till indexing is done * Update integrations/repo_search_test.go * changes as per @mrsdizzie * missing comma * Spelling mistake * Fix full pushing environment
* Only check and config git on web subcommand but not others (#7236)Lunny Xiao2019-06-191-22/+0
| | | | | | * only check and config git on web subcommand but not others * add Init in git tests
* Add CLI commands to manage LDAP authentication source (#6681)ngourdon2019-06-173-1/+1714
| | | | | | | | | | | | | | | | | | * add CLI commands to manage LDAP authentication source * delete Gogs copyright * remove unused return value of func parseLoginSource * fix comment Co-Authored-By: ngourdon <31291059+ngourdon@users.noreply.github.com> * remove config flag already present in global flags * remove config flag from ldap commands in docs * remove config flag handling
* Use certmanager provided TLSConfig for LetsEncrypt (#7229)zeripath2019-06-171-6/+3
|
* Add golangci (#6418)kolaente2019-06-124-11/+28
|
* fix pusher name via ssh push (#7167)Lunny Xiao2019-06-111-1/+1
|
* Add command to convert mysql database from utf8 to utf8mb4 (#7144)Lunny Xiao2019-06-081-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add command to convert mysql database from utf8 to utf8mb4 * Update cmd/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Update cmd/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Update cmd/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Update models/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Update models/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Update cmd/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Update cmd/convert.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>
* Avoid arbitrary format strings upon calling fail() function (#7112)Sandro Santilli2019-06-031-4/+4
|
* Move serv hook functionality & drop GitLogger (#6993)zeripath2019-06-012-213/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move hook functionality internally * Internalise serv logic * Remove old internal paths * finally remove the gitlogger * Disallow push on archived repositories * fix lint error * Update modules/private/key.go * Update routers/private/hook.go * Update routers/private/hook.go * Update routers/private/hook.go * Updated routers/private/serv.go * Fix LFS Locks over SSH * rev-list needs to be run by the hook process * fixup * Improve git test * Ensure that the lfs files are created with a different prefix * Reduce the replication in git_test.go * slight refactor * Remove unnecessary "/" * Restore ensureAnonymousClone * Restore ensureAnonymousClone * Run rev-list on server side * Try passing in the alternative directories instead * Mark test as skipped * Improve git test * Ensure that the lfs files are created with a different prefix * Reduce the replication in git_test.go * Remove unnecessary "/"
* Fix wrong init dependency on markup extensions (#7038)Lunny Xiao2019-05-251-3/+0
| | | | * fix wrong init dependency on markup extensions
* Ignore non-standard refs in git push (#6758)James E. Blair2019-05-141-34/+43
| | | | | | | | | | | | | | | | | | | | | | | When replicating to gitea from a remote system which makes use of git refs to store extra data (for example, gerrit), pushing a lot of refs to gitea can cause problems due to the extra processing that the pre and post receive hooks perform. But it's still useful for gitea to be able to serve those refs. This change skips unecessary processing of refs other than branches or tags. We don't need to check any ref that isn't a branch for branch protection (protection will never be enabled). So in the pre-receive hook, we wrap that check in a test for whether the ref is a branch. We also don't need to add information to the activity stream about pushes to non-standard refs, so we skip that step in the post-receive hook for refs which are not branches or tags. For some concrete examples, gerrit maintains a ref for every patchset of every change in the form refs/changes/XX/YYYY/Z. Many systems use refs/notes to store additonal data about commits. This change allows these and other schemes to be used without affecting gitea.
* Generate access token in admin cli (#6847)Lanre Adelowo2019-05-041-2/+21
| | | | * add cli flag for access token while creating a user
* Rename LFS_JWT_SECRET to include OAUTH2 as well (#6826)techknowlogick2019-05-011-3/+4
|
* Change verbose flag in dump command to avoid colliding with global version ↵John Olheiser2019-05-011-1/+1
| | | | | | | | | flag (#6822) * Change verbose flag to avoid colliding with version flag * Update docs Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Make CustomPath, CustomConf and AppWorkPath configurable at build (#6631)zeripath2019-04-297-148/+0
|
* Add username flag in create-user command (#6534)ngourdon2019-04-091-3/+22
| | | | | | | | | | | | * Add username flag in create-user command * Fix the error message * Change name to username on flag of create-user command * Include create-user flags of both versions * delete deprecated example of create-user command
* Include custom configuration file in dump (#6516)mrsdizzie2019-04-051-0/+8
| | | | | | | When running the dump command, include the specific configuration file provided as part of the backup. Currently we only zip up custom/ and this misses the config file if it is somewhere else, like /etc/gitea/app.ini Fixes #6034
* Better logging (#6038) (#6095)zeripath2019-04-025-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Panic don't fatal on create new logger Fixes #5854 Signed-off-by: Andrew Thornton <art27@cantab.net> * partial broken * Update the logging infrastrcture Signed-off-by: Andrew Thornton <art27@cantab.net> * Reset the skip levels for Fatal and Error Signed-off-by: Andrew Thornton <art27@cantab.net> * broken ncsa * More log.Error fixes Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove nal * set log-levels to lowercase * Make console_test test all levels * switch to lowercased levels * OK now working * Fix vetting issues * Fix lint * Fix tests * change default logging to match current gitea * Improve log testing Signed-off-by: Andrew Thornton <art27@cantab.net> * reset error skip levels to 0 * Update documentation and access logger configuration * Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE * Fix broken level caching * Refactor the router log * Add Router logger * Add colorizing options * Adjust router colors * Only create logger if they will be used * update app.ini.sample * rename Attribute ColorAttribute * Change from white to green for function * Set fatal/error levels * Restore initial trace logger * Fix Trace arguments in modules/auth/auth.go * Properly handle XORMLogger * Improve admin/config page * fix fmt * Add auto-compression of old logs * Update error log levels * Remove the unnecessary skip argument from Error, Fatal and Critical * Add stacktrace support * Fix tests * Remove x/sync from vendors? * Add stderr option to console logger * Use filepath.ToSlash to protect against Windows in tests * Remove prefixed underscores from names in colors.go * Remove not implemented database logger This was removed from Gogs on 4 Mar 2016 but left in the configuration since then. * Ensure that log paths are relative to ROOT_PATH * use path.Join * rename jsonConfig to logConfig * Rename "config" to "jsonConfig" to make it clearer * Requested changes * Requested changes: XormLogger * Try to color the windows terminal If successful default to colorizing the console logs * fixup * Colorize initially too * update vendor * Colorize logs on default and remove if this is not a colorizing logger * Fix documentation * fix test * Use go-isatty to detect if on windows we are on msys or cygwin * Fix spelling mistake * Add missing vendors * More changes * Rationalise the ANSI writer protection * Adjust colors on advice from @0x5c * Make Flags a comma separated list * Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING * Ensure matching is done on the non-colored message - to simpify EXPRESSION
* support custom file name in `gitea dump` command (#6474)glaszig2019-04-011-1/+6
| | | | | | | * support custom file name in `gitea dump` command * simpler approach to handle default dump file name in `gitea dump` command
* move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364)Lunny Xiao2019-03-273-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Clean up various use of escape/unescape functions for URL generation (#6334)mrsdizzie2019-03-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use PathUnescape instead of QueryUnescape when working with branch names Currently branch names with a '+' fail in certain situations because QueryUnescape replaces the + character with a blank space. Using PathUnescape should be better since it is defined as: // PathUnescape is identical to QueryUnescape except that it does not // unescape '+' to ' ' (space). Fixes #6333 * Change error to match new function name * Add new util function PathEscapeSegments This function simply runs PathEscape on each segment of a path without touching the forward slash itself. We want to use this instead of PathEscape/QueryEscape in most cases because a forward slash is a valid name for a branch etc... and we don't want that escaped in a URL. Putting this in new file url.go and also moving a couple similar functions into that file as well. * Use EscapePathSegments where appropriate Replace various uses of EscapePath/EscapeQuery with new EscapePathSegments. Also remove uncessary uses of various escape/unescape functions when the text had already been escaped or was not escaped. * Reformat comment to make drone build happy * Remove no longer used url library * Requested code changes
* Integrate OAuth2 Provider (#5378)Jonas Franz2019-03-081-1/+1
|
* Fix ssh deploy and user key constraints (#1357) (#5939)zeripath2019-02-031-7/+8
| | | | | | | | | | | | | | | | 1. A key can either be an ssh user key or a deploy key. It cannot be both. 2. If a key is a user key - it can only be associated with one user. 3. If a key is a deploy key - it can be used in multiple repositories and the permissions it has on those repositories can be different. 4. If a repository is deleted, its deploy keys must be deleted too. We currently don't enforce any of this and multiple repositories access with different permissions doesn't work at all. This PR enforces the following constraints: - [x] You should not be able to add the same user key as another user - [x] You should not be able to add a ssh user key which is being used as a deploy key - [x] You should not be able to add a ssh deploy key which is being used as a user key - [x] If you add an ssh deploy key to another repository you should be able to use it in different modes without losing the ability to use it in the other mode. - [x] If you delete a repository you must delete all its deploy keys. Fix #1357