Commit Graph
33 Commits
Author SHA1 Message Date
GustedandGitHub ff2fd08228 Simplify parameter types (#18006)
Remove repeated type declarations in function definitions.
2021-12-20 04:41:31 +00:00
34b5436ae1 Refactor various strings (#17784)
Fixes #16478

Co-authored-by: Gusted <[email protected]>

Co-authored-by: Gusted <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2021-12-02 15:28:08 +08:00
zeripathandGitHub 01087e9eef Make Requests Processes and create process hierarchy. Associate OpenRepository with context. (#17125)
This PR registers requests with the process manager and manages hierarchy within the processes.

Git repos are then associated with a context, (usually the request's context) - with sub commands using this context as their base context.

Signed-off-by: Andrew Thornton <[email protected]>
2021-11-30 20:06:32 +00:00
7e9bd206fd Fix bundle creation (#17079)
Signed-off-by: Alexey Terentyev <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: Gwyneth Morgan <[email protected]>
Co-authored-by: Gwyneth Morgan <[email protected]>
2021-09-26 00:29:25 +03:00
John OlheiserandGitHub 648464b504 Add bundle download for repository (#14538)
* Add bundle download

Signed-off-by: jolheiser <[email protected]>

* Fix fmt

Signed-off-by: jolheiser <[email protected]>

* Fix build tags

Signed-off-by: jolheiser <[email protected]>

* Download specific commit

Signed-off-by: jolheiser <[email protected]>
2021-08-24 11:47:09 -05:00
f9acad82ca Add proxy settings and support for migration and webhook (#16704)
* 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 <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: zeripath <[email protected]>
2021-08-18 21:10:39 +08:00
d9ef43a712 Replace list.List with slices (#16311)
* 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 <[email protected]>
2021-08-09 14:08:51 -04:00
08f4b3f312 Fix 500 Error with branch and tag sharing the same name #15592 (#16040)
* Fix 500 Error with branch and tag sharing the same name #15592

Fixed 500 error while create Pull request when there are more
than one sources (branch, tag) with the same name

Fix #15592

Signed-off-by: Viktor Yakovchuk <[email protected]>

* fix logging

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: 6543 <[email protected]>
2021-06-23 17:08:26 -04:00
KN4CK3RandGitHub 440039c0cc Add push to remote mirror repository (#15157)
* Added push mirror model.

* Integrated push mirror into queue.

* Moved methods into own file.

* Added basic implementation.

* Mirror wiki too.

* Removed duplicated method.

* Get url for different remotes.

* Added migration.

* Unified remote url access.

* Add/Remove push mirror remotes.

* Prevent hangs with missing credentials.

* Moved code between files.

* Changed sanitizer interface.

* Added push mirror backend methods.

* Only update the mirror remote.

* Limit refs on push.

* Added UI part.

* Added missing table.

* Delete mirror if repository gets removed.

* Changed signature. Handle object errors.

* Added upload method.

* Added "upload" unit tests.

* Added transfer adapter unit tests.

* Send correct headers.

* Added pushing of LFS objects.

* Added more logging.

* Simpler body handling.

* Process files in batches to reduce HTTP calls.

* Added created timestamp.

* Fixed invalid column name.

* Changed name to prevent xorm auto setting.

* Remove table header im empty.

* Strip exit code from error message.

* Added docs page about mirroring.

* Fixed date.

* Fixed merge errors.

* Moved test to integrations.

* Added push mirror test.

* Added test.
2021-06-14 19:20:43 +02:00
6543andGitHub a19447aed1 migrate from com.* to alternatives (#14103)
* remove github.com/unknwon/com from models

* dont use "com.ToStr()"

* replace "com.ToStr" with "fmt.Sprint" where its easy to do

* more refactor

* fix test

* just "proxy" Copy func for now

* as per @lunny
2020-12-25 11:59:32 +02:00
511f6138d4 Use native git variants by default with go-git variants as build tag (#13673)
* Move last commit cache back into modules/git

Signed-off-by: Andrew Thornton <[email protected]>

* Remove go-git from the interface for last commit cache

Signed-off-by: Andrew Thornton <[email protected]>

* move cacheref to last_commit_cache

Signed-off-by: Andrew Thornton <[email protected]>

* Remove go-git from routers/private/hook

Signed-off-by: Andrew Thornton <[email protected]>

* Move FindLFSFiles to pipeline

Signed-off-by: Andrew Thornton <[email protected]>

* Make no-go-git variants

Signed-off-by: Andrew Thornton <[email protected]>

* Submodule RefID

Signed-off-by: Andrew Thornton <[email protected]>

* fix issue with GetCommitsInfo

Signed-off-by: Andrew Thornton <[email protected]>

* fix GetLastCommitForPaths

Signed-off-by: Andrew Thornton <[email protected]>

* Improve efficiency

Signed-off-by: Andrew Thornton <[email protected]>

* More efficiency

Signed-off-by: Andrew Thornton <[email protected]>

* even faster

Signed-off-by: Andrew Thornton <[email protected]>

* Reduce duplication

* As per @lunny

Signed-off-by: Andrew Thornton <[email protected]>

* attempt to fix drone

Signed-off-by: Andrew Thornton <[email protected]>

* fix test-tags

Signed-off-by: Andrew Thornton <[email protected]>

* default to use no-go-git variants and add gogit build tag

Signed-off-by: Andrew Thornton <[email protected]>

* placate lint

Signed-off-by: Andrew Thornton <[email protected]>

* as per @6543

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-12-17 22:00:47 +08:00
6543andGitHub 2b4a08e962 Migrations: Use Process Manager to create own Context (#13792) 2020-12-02 18:36:06 +00:00
c05a8abc76 Multiple GitGraph improvements: Exclude PR heads, Add branch/PR links, Show only certain branches, (#12766)
* Multiple GitGraph improvements.

Add backend support for excluding PRs, selecting branches and files.

Fix #10327

Signed-off-by: Andrew Thornton <[email protected]>

* as per @silverwind

Signed-off-by: Andrew Thornton <[email protected]>

* as per @silverwind

Signed-off-by: Andrew Thornton <[email protected]>

* Only show refs in dropdown we display on the graph

Signed-off-by: Andrew Thornton <[email protected]>

* as per @silverwind

Signed-off-by: Andrew Thornton <[email protected]>

* use flexbox for ui header

Signed-off-by: Andrew Thornton <[email protected]>

* Move Hide Pull Request button to the dropdown

Signed-off-by: Andrew Thornton <[email protected]>

* Add SHA and user pictures

Signed-off-by: Andrew Thornton <[email protected]>

* fix test

Signed-off-by: Andrew Thornton <[email protected]>

* fix test 2

Signed-off-by: Andrew Thornton <[email protected]>

* fixes

* async

* more tweaks

* use tabs in tmpl

Signed-off-by: Andrew Thornton <[email protected]>

* remove commented thing

Signed-off-by: Andrew Thornton <[email protected]>

* fix linting

Signed-off-by: Andrew Thornton <[email protected]>

* Update web_src/js/features/gitgraph.js

Co-authored-by: silverwind <[email protected]>

* graph tweaks

* more tweaks

* add title

Signed-off-by: Andrew Thornton <[email protected]>

* fix loading indicator z-index and position

Co-authored-by: silverwind <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2020-11-08 12:21:54 -05:00
7cd47046ea Handle push rejection in branch and upload (#10854)
* 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 <[email protected]>
Co-authored-by: guillep2k <[email protected]>
2020-03-28 01:13:18 -03:00
Lauris BHandGitHub 43c09134a9 Migrate to go-git/go-git v5.0.0 (#10735) 2020-03-17 12:19:58 -04:00
15a5c10d33 Variable expansion in repository templates (#9163)
* Start expansion

Signed-off-by: jolheiser <[email protected]>

* _template rather than .template

Signed-off-by: jolheiser <[email protected]>

* Use ioutil

Signed-off-by: jolheiser <[email protected]>

* Add descriptions to mapping

* Start globbing

Signed-off-by: jolheiser <[email protected]>

* Tune globbing

Signed-off-by: jolheiser <[email protected]>

* Re-arrange imports

Signed-off-by: jolheiser <[email protected]>

* Don't expand git hooks

Signed-off-by: jolheiser <[email protected]>

* Add glob tests for .giteatemplate

Signed-off-by: jolheiser <[email protected]>

* Parse globs separately so they can be tested more easily

Signed-off-by: jolheiser <[email protected]>

* Change template location and add docs

Signed-off-by: jolheiser <[email protected]>

* nit

Signed-off-by: jolheiser <[email protected]>

* Update docs/content/doc/features/gitea-directory.md

Co-Authored-By: guillep2k <[email protected]>

* Update docs/content/doc/features/gitea-directory.md

Co-Authored-By: guillep2k <[email protected]>

* Add upper-lower case match

Signed-off-by: jolheiser <[email protected]>

* Nits

Signed-off-by: jolheiser <[email protected]>

* Update models/repo_generate.go

Co-Authored-By: guillep2k <[email protected]>
2019-11-30 01:54:47 -05:00
Lunny XiaoandAntoine GIRARD 7b7d382b8b Fix datarace on git.GlobalCommandArgs on tests (#9162)
* fix datarace on git.GlobalCommandArgs on tests

* fix tests

* fix tests

* fix tests
2019-11-27 01:35:52 +01:00
zeripathandGitHub 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
2019-11-13 07:01:19 +00:00
zeripathandGitHub ee1d64ddd1 Stop using git count-objects and use raw directory size for repository (#8848)
* Migrate from git count-objects to a raw directory size
* As per @guillep2k ignore unusual files
2019-11-10 21:33:47 +00:00
jaqraandLauris BH 065bbddab9 Fix count for commit graph last page (#8843)
* Fix count for commit graph last page

* Remove used once variable

* Move func to model

* capitalize method name

* fix error message
2019-11-07 20:09:51 +02:00
zeripathandGitHub 5e6a008fba Add basic repository lfs management (#7199)
This PR adds basic repository LFS management UI including the ability to find all possible pointers within the repository. Locks are not managed at present but would be addable through some simple additions.

* Add basic repository lfs management
* add auto-associate function
* Add functionality to find commits with this lfs file
* Add link to find commits on the lfs file view
* Adjust commit view to state the likely branch causing the commit
* Only read Oid from database
2019-10-28 18:31:55 +00:00
zeripathandGitHub fcb535c5c3 Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631)
This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however.

## Features
- [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.)
- [x] Verify commits signed with the default gpg as valid
- [x] Signer, Committer and Author can all be different
    - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon.
- [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available
    - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg
    - [x] Try to match the default key with a user on gitea - this is done at verification time
- [x] Make things configurable?
    - app.ini configuration done
    - [x] when checking commits are signed need to check if they're actually verifiable too
- [x] Add documentation

I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
2019-10-16 14:42:42 +01:00
Tamal Sahaandtechknowlogick 171b359877 Use gitea forked macaron (#7933)
Signed-off-by: Tamal Saha <[email protected]>
2019-08-23 12:40:29 -04:00
zeripathandGitHub 7ad67109d7 Be more strict with git arguments (#7715)
* Be more strict with git arguments
* fix-up commit test
* use bindings for branch name
2019-08-05 21:39:39 +01:00
Lunny Xiaoandtechknowlogick edc94c7041 Monitor all git commands; move blame to git package and replace git as a variable (#6864)
* monitor all git commands; move blame to git package and replace git as a variable

* use git command but not other commands

* fix build

* move exec.Command to git.NewCommand

* fix fmt

* remove unrelated changes

* remove unrelated changes

* refactor IsEmpty and add tests

* fix tests

* fix tests

* fix tests

* fix tests

* remove gitLogger

* fix fmt

* fix isEmpty

* fix lint

* fix tests
2019-06-26 14:15:26 -04:00
kolaenteandtechknowlogick f9ec2f89f2 Add golangci (#6418) 2019-06-12 15:41:28 -04:00
zeripathandtechknowlogick ce8de35334 Remove local clones & make hooks run on merge/edit/upload (#6672)
* Add options to git.Clone to make it more capable

* Begin the process of removing the local copy and tidy up

* Remove Wiki LocalCopy Checkouts

* Remove the last LocalRepo helpers

* Remove WithTemporaryFile

* Enable push-hooks for these routes

* Ensure tests cope with hooks

Signed-off-by: Andrew Thornton <[email protected]>

* Remove Repository.LocalCopyPath()

* Move temporary repo to use the standard temporary path

* Fix the tests

Signed-off-by: Andrew Thornton <[email protected]>

* Remove LocalWikiPath

* Fix missing remove

Signed-off-by: Andrew Thornton <[email protected]>

* Use AppURL for Oauth user link (#6894)

* Use AppURL for Oauth user link

Fix #6843

* Update oauth.go

* Update oauth.go

* internal/ssh: ignore env command totally (#6825)

* ssh: ignore env command totally

* Remove commented code 

Needed fix described in issue #6889

* Escape the commit message on issues update and title in telegram hook (#6901)

* update sdk to latest (#6903)

* improve description of branch protection (fix #6886) (#6906)

The branch protection description text were not quite accurate.

* Fix logging documentation (#6904)

* ENABLE_MACARON_REDIRECT should be REDIRECT_MACARON_LOG

* Allow DISABLE_ROUTER_LOG to be set in the [log] section

* [skip ci] Updated translations via Crowdin

* Move sdk structs to modules/structs (#6905)

* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
2019-05-11 11:29:17 -04:00
Mario LubenkaandLauris BH 55a8e12d85 Number of commits ahead/behind in branch overview (#6695)
* Call Git API to determine divergence of a branch and its base branch

Signed-off-by: Mario Lubenka <[email protected]>

* Show commit divergance in branch list

Signed-off-by: Mario Lubenka <[email protected]>

* Adds missing comment

Signed-off-by: Mario Lubenka <[email protected]>

* Adds test for diverging commits

Signed-off-by: Mario Lubenka <[email protected]>

* Try comparing commits instead of branches

Signed-off-by: Mario Lubenka <[email protected]>

* Removes test as CI can't run it

Signed-off-by: Mario Lubenka <[email protected]>

* Adjusts signature of percentage function to allow providing multiple integers as numerator

Signed-off-by: Mario Lubenka <[email protected]>

* Moves CountDivergingCommits function into repofiles module

Signed-off-by: Mario Lubenka <[email protected]>
2019-05-05 19:25:25 +03:00
Filip NavaraandLunny Xiao 2af67f6044 Improve listing performance by using go-git (#6478)
* Use go-git for tree reading and commit info lookup.

Signed-off-by: Filip Navara <[email protected]>

* Use TreeEntry.IsRegular() instead of ObjectType that was removed.

Signed-off-by: Filip Navara <[email protected]>

* Use the treePath to optimize commit info search.

Signed-off-by: Filip Navara <[email protected]>

* Extract the latest commit at treePath along with the other commits.

Signed-off-by: Filip Navara <[email protected]>

* Fix listing commit info for a directory that was created in one commit and never modified after.

Signed-off-by: Filip Navara <[email protected]>

* Avoid nearly all external 'git' invocations when doing directory listing (.editorconfig code path is still hit).

Signed-off-by: Filip Navara <[email protected]>

* Use go-git for reading blobs.

Signed-off-by: Filip Navara <[email protected]>

* Make SHA1 type alias for plumbing.Hash in go-git.

Signed-off-by: Filip Navara <[email protected]>

* Make Signature type alias for object.Signature in go-git.

Signed-off-by: Filip Navara <[email protected]>

* Fix GetCommitsInfo for repository with only one commit.

Signed-off-by: Filip Navara <[email protected]>

* Fix PGP signature verification.

Signed-off-by: Filip Navara <[email protected]>

* Fix issues with walking commit graph across merges.

Signed-off-by: Filip Navara <[email protected]>

* Fix typo in condition.

Signed-off-by: Filip Navara <[email protected]>

* Speed up loading branch list by keeping the repository reference (and thus all the loaded packfile indexes).

Signed-off-by: Filip Navara <[email protected]>

* Fix lising submodules.

Signed-off-by: Filip Navara <[email protected]>

* Fix build

Signed-off-by: Filip Navara <[email protected]>

* Add back commit cache because of name-rev

Signed-off-by: Filip Navara <[email protected]>

* Fix tests

Signed-off-by: Filip Navara <[email protected]>

* Fix code style

* Fix spelling

* Address PR feedback

Signed-off-by: Filip Navara <[email protected]>

* Update vendor module list

Signed-off-by: Filip Navara <[email protected]>

* Fix getting trees by commit id

Signed-off-by: Filip Navara <[email protected]>

* Fix remaining unit test failures

* Fix GetTreeBySHA

* Avoid running `git name-rev` if not necessary

Signed-off-by: Filip Navara <[email protected]>

* Move Branch code to git module

* Clean up GPG signature verification and fix it for tagged commits

* Address PR feedback (import formatting, copyright headers)

* Make blob lookup by SHA working

* Update tests to use public API

* Allow getting content from any type of object through the blob interface

* Change test to actually expect the object content that is in the GIT repository

* Change one more test to actually expect the object content that is in the GIT repository

* Add comments
2019-04-19 20:17:27 +08:00
Lunny XiaoandGitHub 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
2019-03-27 17:33:00 +08:00
Unknwon 9a2e43bff2 move out git module and #1573 send push hook 2015-12-09 20:46:05 -05:00
Unknwon 987dcc5372 fix #1383 2015-11-20 02:38:41 -05:00
Unknwon 8dd07c0ddd New UI merge in progress 2014-07-26 00:24:27 -04:00