Commit Graph

2315 Commits

Author SHA1 Message Date
guillep2k 4fe490f062 Fixes indexed repos keeping outdated indexes when files grow too large (#7712) 2019-08-03 18:42:09 +01:00
Antoine GIRARD 76408d50fb org/members: display 2FA members states + optimize sql requests (#7621)
* org/members: display 2FA state

* fix comment typo

* lay down UserList bases

* add basic test for previous methods

* add comment for UserList type

* add valid two-fa account

* test new UserList methods

* optimize MembersIsPublic by side loading info on GetMembers + fix integrations tests

* respect fmt rules

* use map for data

* Optimize GetTwoFaStatus

* rewrite by using existing sub func

* Optimize IsUserOrgOwner

* remove un-used code

* tests: cover empty org + fix import order

* tests: add ErrTeamNotExist path

* tests: fix wrong expected result
2019-08-02 12:06:27 -04:00
guillep2k 3566d2c860 Include "executable" files in the index, as they are not necessarily binary (#7718) 2019-08-02 23:14:50 +08:00
guillep2k 06392479b4 Skip non-regular files (e.g. submodules) on repo indexing (#7711) 2019-08-02 07:57:53 +01:00
Lunny Xiao 0742f717ad
fix duplicated webhook when creating issue with assignees (#7681) 2019-07-31 17:24:38 +08:00
David Svantesson 41336351b7 Move add to hook queue for created repo to outside xorm session. (#7675)
Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
2019-07-31 09:13:04 +03:00
Lunny Xiao e7d4895732
Move commit repo action from models to repofiles package (#7645)
* move commit repo action from models to repofiles package

* fix unit tests
2019-07-30 09:59:10 +08:00
zeripath 4d643a59db SetDefaultBranch on pushing to empty repository (#7610) 2019-07-30 09:05:33 +08:00
Lunny Xiao 0c927b1606
change length of some repository's columns (#7652) 2019-07-29 11:29:42 +08:00
renothing cbf231a675 fix wrong email when use gitea as OAuth2 provider (#7640)
when you use gitea as OAuth2 provider, the /api/v1/user should return
user primary email as identifier, which is unique in OAuth2 clients.

this patch use convert.ToUser replace all u.APIFormat in api requests,
return primary email when caller is yourself or admin.
2019-07-27 16:15:30 +03:00
Andreas Shimokawa cdaf9a5ef5 reserve .well-known username (#7637) 2019-07-26 16:06:21 -04:00
Lunny Xiao 6782a704ef Fix bug create/edit wiki pages when code master branch protected (#7580)
* fix bug create/edit wiki pages when code master branch protected

* improve FullPushingEnvironment function
2019-07-25 22:50:20 +01:00
zeripath 18c0e9c2a9
Make PKCS8, PEM and SSH2 keys work (#7600)
* Make PEM and SSH2 keys work

* add ssh2 testcases and PEM cases - and fix PEM

* Add final test to parse the proposed key
2019-07-25 20:33:38 +01:00
zeripath 6485962dd5
Fix panic on push at #7611 (#7615)
* Fix panic in #7611

Use pr.IssueID instead of pr.Issue.ID as Issue may not be loaded and is unnecessary

* Only fetch the head branch from the remote
2019-07-25 19:05:51 +01:00
zeripath 734aa96508
Fix #7136: Add paging and extend API GetCommitStatuses (#7141)
* Fix #7136: Add paging and extend API GetCommitStatuses

* update swagger

* Update routers/api/v1/repo/status.go

Co-Authored-By: techknowlogick <matti@mdranta.net>

* Update routers/api/v1/repo/status.go

Co-Authored-By: techknowlogick <matti@mdranta.net>

* Update routers/api/v1/repo/status.go

Co-Authored-By: techknowlogick <matti@mdranta.net>

* Apply suggestions from code review
2019-07-25 11:55:06 +01:00
Lunny Xiao 2c5c458dd7
Move models.PushUpdate to repofiles.PushUpdate (#7485)
* move models.PushUpdate to repofiles.PushUpdate

* remove duplicated code to load repo
2019-07-24 15:13:26 +08:00
Christian Muehlhaeuser 5e4e7d3df0 Added missing error checks in tests (#7554)
Whenever we assign a value to err, check for it being nil.
2019-07-23 20:28:43 +01:00
Christian Muehlhaeuser 54d96c79b5 Removed unnecessary conversions (#7557)
No need to convert to the same type.
2019-07-23 19:50:39 +01:00
silverwind b10109ffe8 Improve SSH key parser to handle newlines in keys (#7522)
* Strip newlines from SSH keys before adding them

Fixes: https://github.com/go-gitea/gitea/issues/7500

* add test for CheckPublicKeyString

* add one more test

* simplify test

* further simplify

* make fmt
2019-07-23 16:25:06 +03:00
Christian Muehlhaeuser b0cd3b8ab9 Fixed ineffectual assignments (#7555)
Don't assign values we never use.
2019-07-22 17:35:53 +08:00
Christian Muehlhaeuser 12a098920c Fixed ineffectual assignments in tests (#7553)
Just makes it a bit more obvious which values we want to test for, and which
ones we want to ignore.
2019-07-22 15:11:16 +08:00
Lunny Xiao e0d6d2f978 Fix repository's pull request count error (#7518)
* fix pr count error

* fix tests
2019-07-18 22:51:33 +01:00
mrsdizzie 944d904980 Include thread related headers in issue/coment mail (#7484)
* Include thread related headers in issue/coment mail

Make it so mail programs will group comments from an issue into the same
thread by setting Message-ID on initial issue and then using In-Reply-To
and References headers to reference that later on.

* Add tests

* more tests

* fix typo
2019-07-17 15:02:42 -04:00
Monty Taylor 361607d831 Update User.NumRepos atomically in createRepository (#7493)
The update call on the user call races if there is more than one
repository creation concurrently, leading to incorrect count of
repos. Split things in two, so that we call the update for last
visibility (which isn't problematic if it races, since it can only
ever be best-effort anyway). This way we can atomically increment
the count of repos.
2019-07-17 13:34:13 -04:00
Lunny Xiao d2958d9f46 Move status table to cron package (#7370) 2019-07-15 20:13:03 -04:00
mrsdizzie fb0c562f8b Fix regex for issues in commit messages (#7444)
* Fix regex for issues in commit messages

Use same regex as markup for matching in commits.

Fixes #7438

* make fmt
2019-07-14 22:48:51 +08:00
quantonganh ff85a6331e only return head: null if source branch was deleted (#6705)
* only return head: null if source branch was deleted

* add URL into GetPullRequest

* TestPullRequest_APIFormat

* log error if it is not Err(Branch)NotExist
2019-07-08 10:32:46 +03:00
mrsdizzie 1f1ecda541 Display original author and URL information when showing migrated issues/comments (#7352)
* Store original author info for migrated issues and comments

Keep original author name for displaying in Gitea interface and also
store original author user ID for potential future use in linking
accounts from old location.

* Add original_url for repo

Store the original URL for a migrated repo

Clean up migrations/tests

* fix migration

* fix golangci-lint

* make 'make revive' happy also

* Modify templates to use OriginalAuthor if set

Use the original author name in templates if it is set rather than the
user who migrated/currently owns the issues

* formatting fixes

* make generate-swagger

* Use default avatar for imported comments

* Remove no longer used IgnoreIssueAuthor option

* Add OriginalAuthorID to swagger also
2019-07-08 10:14:12 +08:00
EpicCoder 8d9d6aa903 Add additional password hash algorithms (closes #5859) (#6023) 2019-07-07 02:01:01 -04:00
Drew 89aa08d372 Fix mirror sync not automatically sending webhook requests (#7366) 2019-07-06 16:01:21 -04:00
Lunny Xiao 337d6915ff Detect migrating batch size (#7353)
* Make migrating batch size as configurable

* detect different table batch insert size and remove config item

* remove unrelated changes
2019-07-06 15:24:50 -04:00
Lunny Xiao e728b55812 Fix bug conflict between SyncReleasesWithTags and InsertReleases (#7337)
* fix bug conflict between SyncReleasesWithTags and InsertReleases

* fix tests

* fix fmt
2019-07-01 22:17:16 +01:00
zeripath 9fdd199cca make dropTableColumns drop columns on sqlite and constraints on all (#6849) 2019-07-01 15:26:59 -04:00
zeripath 3563650bdb #6946 Run hooks on merge/edit and cope with protected branches (#6961)
* 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
2019-07-01 09:18:13 +08:00
Lunny Xiao ff85dd3e12 Add commit statuses reports on pull request view (#6845)
* Add commit statuses reports on pull view

* Add some translations

* improve the UI

* fix fmt

* fix tests

* add a new test git repo to fix tests

* fix bug when headRepo or headBranch missing

* fix tests

* fix tests

* fix consistency

* fix tests

* fix tests

* change the test repo

* fix tests

* fix tests

* fix migration

* keep db size consistency

* fix translation

* change commit hash status table unique index

* remove unused table

* use char instead varchar

* make hashCommitStatusContext private

* split merge section with status check on pull view ui

* fix tests; fix arc-green theme on pull ui
2019-06-30 08:57:59 +01:00
Lunny Xiao 462284e2f5
Use batch insert on migrating repository to make the process faster (#7050)
* Use batch insert on migrating repository to make the process faster

* fix lint

* fix tests

* fix comments
2019-06-29 21:38:22 +08:00
Mario Lubenka 7c0f2b9843 Show Pull Request button or status of latest PR in branch list (#6990)
* Show Pull Request button or status of latest PR in branch list

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Do not show pull request button on deleted branches

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Do not show commit divergence on deleted branches

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Use XORMs Get instead of limit

* Links pull request ID and use smaller labels for displaying the pull request status

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Handle error when getting latest pull request

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Indent template

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Check error when loading issue

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
2019-06-27 22:15:30 +08:00
silverwind da23041257 fix extra newlines when copying from diff in Firefox (#7288)
* fix extra newlines when copying from diff

See https://bugzilla.mozilla.org/show_bug.cgi?id=1273836

Basically, the <pre><code> seems to add a forced newline that is not
possible to get rid of via CSS, so I replaced it with just a <code>.

Secondly, .lines-type-marker also forced a newline in the copied text,
but that was possible to get rid of via user-select.

Safari still has a extraneous newline in the copied text of unknown
origin, but this should not block stop this PR.

* simplify .line-type-marker

* fix selector

* remove erronous ^^^

* Fix empty split diff

* Fix arc-theme-green

* fix add comment

* ensure line-num is copied too

* Update templates/repo/diff/box.tmpl

Co-Authored-By: zeripath <art27@cantab.net>

* attempt to fix safari via removing <code>

* remove useless whitespace at the end of 'class'

* remove inter-tag whitespace for code <td>s

* more inter-tag removal

* final inter-tag removal

* attempt to fix empty line copy

* move and comment getLineContent

* fix golint

* make background grey for missing added code
2019-06-26 22:35:07 +01:00
Lunny Xiao 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
zeripath 5908bb1030
Make diff line-marker non-selectable (#7279)
* Make diff line-marker non-selectable
* Move to use data-* as per @mrsdizzie
* fix missing line nums
* Add a minimum-width to force right-align of the line num
* Move line-type-marker into separate column
2019-06-24 21:23:52 +01:00
Lunny Xiao aa7c34cf86 Fix error log when loading issues caused by a xorm bug (#7271)
* fix error log when loading issues caused by a xorm bug

* upgrade packages

* fix fmt

* fix Consistency

* fix tests
2019-06-23 18:22:43 +03:00
zeripath baefea311f
Fix #732: Add LFS objects to base repository on merging (#7082)
On merge we walk the merge history and ensure that all lfs objects pointed to in
the history are added to the base repository. This switches from relying on having git-lfs installed on the server, (and in fact .gitattributes being correctly installed.)
2019-06-22 18:35:34 +01:00
Lunny Xiao d8168b356d
Add missing description of label on API (#7159)
* add missing description of label on API

* fix comment head

* fix swagger
2019-06-16 20:39:52 +08:00
Antoine GIRARD 367aeb169a Use go method to calculate ssh key fingerprint (#7128)
* Use go method to calculate key fingerprint

* add gitea copyright

* use native go method only for built-in server

* refactor and add tests

* add gitea copyright
2019-06-16 08:50:46 +01:00
zeripath cf2221e3ac Add LastLogin to the User API (#7196) 2019-06-15 23:28:32 -04:00
zeripath cde410521c
Only warn on errors in deleting LFS orphaned files during repo deletion (#7213) 2019-06-15 23:20:29 +01:00
Lunny Xiao 0323122fd7 fix duplicated file on pull request conflicted files (#7211) 2019-06-15 15:22:26 +01:00
zeripath 94ceaf1c0c Allow colon between fixing word and issue (#7207)
* Allow colon between fixing word and issue

* update test
2019-06-15 00:00:32 -04:00
John Olheiser 744fd6a1c8 Add error for fork already existing (#7185) 2019-06-12 16:20:43 -04:00
kolaente f9ec2f89f2 Add golangci (#6418) 2019-06-12 15:41:28 -04:00