Commit Graph
50 Commits
Author SHA1 Message Date
b60e814055 Enable race detector for CI (#1441)
* Enable race detector by default

Set RACE_ENABLED=0 to disable it when release

* Disable race detector for release builds

* use `true`

* fix

* debug issue

* fix

* verbose

* clean

* Fix wrong merge

* Fix coverage merge

Co-authored-by: Mura Li <typeless@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-26 16:50:04 +08:00
fd6b1be1b6 Replace ARCCache with TwoQueueCache to avoid patent issue (#16240)
Co-authored-by: Mura Li <typeless@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2021-06-24 14:37:07 -04:00
19dedc3fa5 Speed up git diff highlight generation (#16180)
Co-authored-by: Mura Li <typeless@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2021-06-17 10:55:16 -04:00
09304db9a5 Use the text of pull-request as the squash commit's message (#13071)
Originally, it was filled by the commit messages of the involved
commits. In this change, we use the headline comment of the pull
request as the commit message when it is a squash merge.

Thanks to @zeripath for suggesting the idea.

Fixes #12365

Co-authored-by: Mura Li <typeless@users.noreply.github.com>
2020-12-21 17:46:14 +01:00
514e269b1d Support running subtests manually (#10988)
Since GNU Make does not allow '/' in the target patterns,
we tranlate the subsequent '.' into '/' for "go test -run".

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-07 01:31:11 -03:00
Mura LiandLunny Xiao 6e6936d73d Fix nondeterministic behavior (#9341)
The underlying implementation of os.exec uses channels and goroutines.
It is possible to have time-variant error values returned from Cmd.Wait
depending on which comes first.

Also, the git subcommand and options should be separated tokens.

Fixes a flaky test in modules/git/command_test.go
2019-12-13 17:03:38 +08:00
Mura LiandLauris BH 9591185c8f Upgrade blevesearch to v0.8.1 (#9177)
For #1441

https://github.com/blevesearch/bleve/commit/a91b427b59b893f112021841ba7370d285f8426f
2019-11-27 11:23:33 +02:00
Mura LiandLauris BH eec997d30a Fix data race (#8204)
* Fix data race

* Fix data race in modules/log

* Make the scope of lock finner-grained

* Use syc.Map

* Fix missing change in the test

* Do not export LoggerMap
2019-09-17 12:39:37 +03:00
Mura Liandtechknowlogick a5f87feefd Fix pull merge 500 error caused by git-fetch breaking behaviors (#8161) 2019-09-15 23:03:08 -04:00
Mura LiandLauris BH c027eac1d6 Avoid ambiguity of branch/directory names for the git-diff-tree command (#8066) 2019-09-03 15:42:01 +03:00
032c90e7c5 Add tooltip for the visibility checkbox in /repo/create (#8025)
* Add tooltip for the visibility checkbox in /repo/create

* Change the tooltip wording

* Update options/locale/locale_en-US.ini

Co-Authored-By: Lauris BH <lauris@nix.lv>
2019-09-02 18:29:04 -04:00
Mura LiandAntoine GIRARD dd3ba9bb6b Fix make-generate using non-vendor packages (#8008) 2019-08-28 22:18:15 +02:00
Mura Liandtechknowlogick 3ac45e3cb5 Fix pull creation with empty changes (#7920)
* Logs the stderr of git-apply
* Add an integration test
* Skip testPatch when patch is empty
2019-08-20 13:43:00 -04:00
Mura Liandtechknowlogick a678ea44b8 Update MAINTAINERS (#7896) 2019-08-16 23:17:34 -04:00
Mura LiandLauris BH 602155df7b Do not fetch all refs (#7797)
Which would unnecessarily slow down the pull compare operation.
2019-08-13 11:30:44 +03:00
Mura Liandtechknowlogick f88aa1d215 Support git.PATH entry in app.ini (#6772) 2019-07-07 03:26:56 -04:00
Mura Liandzeripath 5a722ae812 Timeout test commands without complicated tricks (#7020) 2019-05-26 00:13:01 +01:00
Mura Liandtechknowlogick 0b785481d7 Use modules/git for git commands (#6775) 2019-05-13 01:06:47 -04:00
Mura LiandLauris BH 2a9806bfc6 Pre-calculate the absolute path of git (#6575)
* Pre-caculate the absolute path of git

* Do not repeat string literals which has been defined somewhere

Also make it flexible to accept customized/user-defined value.
2019-04-17 14:11:37 +03:00
Mura LiandLunny Xiao 3186ef554c Support search operators for commits search (#6479)
* Support searching commits with prefix syntax

For now, support auther: committer:
When more than one prefix is supplied is presented, the result is the union.
When different prefixes are supplied, the result is the intersection.

For example,
"author:alice author:bob"
=> the result is all commits authored by Alice OR Bob

"hello committer:alice"
=> the result is all commits committed by Alice AND has the keyword
'hello' in the message.

Note that there should NOT have any space after the colon(:) of the prefix.
For example,
"author:bill" => correct
"author: bill" => wrong

* Remove unneeded logging

* Add missing files of test repository

* Add missing repo_unit entries to test fixtures

* Update test cases

* Add tooltip for commits search button

* Update tooltip text

I have no idea about how to format it with line breaks.

* Make the usage example more real

* Add a test case

* Add new options struct for SearchCommits

* Prefer len(s) > 0 over s != ""

* Add NewSearchCommitsOptions
2019-04-12 10:28:44 +08:00
Mura Liandtechknowlogick d8802b1298 Add a new Make target for running single integration test (#6500)
* Add a new Make target for running single integration test

* Use # instead of - as the delimiter
2019-04-04 12:22:10 -04:00
Mura LiandLunny Xiao d77176912b Use Go1.11 module (#5743)
* Migrate to go modules

* make vendor

* Update mvdan.cc/xurls

* make vendor

* Update code.gitea.io/git

* make fmt-check

* Update github.com/go-sql-driver/mysql

* make vendor
2019-03-27 19:15:23 +08:00
Mura LiandLauris BH ec31ee1c1c Make sure .git/info is created before generating .git/info/sparse-che… (#5825)
* Make sure .git/info is created before generating .git/info/sparse-checkout

* fix permissions
2019-01-24 09:43:37 +02:00
Mura LiandLauris BH 6ad834e236 Optimize pulls merging (#4921)
* Optimize pulls merging

By utilizing `git clone -s --no-checkout` rather than cloning the whole
repo.

* Use sparse-checkout to speedup pulls merge

* Use bytes.Buffer instead of strings.Builder for backward compatibility

* Fix empty diff-tree output for repos with only the initial commit

* Fix missing argument for the format string

* Rework diff-tree-list generation

* Remove logging code

* File list for sparse-checkout must be prefix with /

Otherwise, they would match all files with the same name under
subdirectories.

* Update onto the rebased head

* Use referecen repo to avoid fetching objects
2019-01-23 12:26:32 +02:00
Mura Liandtechknowlogick 9a33798b30 Fix type mismatch of format string (#5574) 2018-12-21 11:13:31 -05:00
Mura Liandtechknowlogick 7694c99ab3 Kill testing processes if the test takes too long (#5174)
When timeout, Send ABRT signal to print backtraces for diagnosis.
The timeout value is set to 1200s (20mins) for now.
2018-10-28 21:54:13 -04:00
Mura LiandLunny Xiao 554581f848 Disable sqlite test (#5178)
For #5172
2018-10-25 18:37:46 +08:00
Mura LiandLunny Xiao 317ddb7283 Update vendor/github.com/mattn/go-sqlite3 (#5162)
To fix build failure on Windows/386
2018-10-24 16:18:51 +08:00
Mura Liandtechknowlogick efa4e6bc6f Update the docs for sqlite_unlock_notify (#5145) 2018-10-23 12:33:51 -04:00
Mura Liandtechknowlogick 159c2ffb0e Update outdated Go toolchain version for .drone.yml (#5146) 2018-10-23 12:08:05 -04:00
Mura LiandLunny Xiao 25c49cf930 Update build tags for sqlite_unlock_notify (#5144) 2018-10-23 19:47:59 +08:00
Mura LiandLunny Xiao 2ce72d4e00 Update vendor/go-sqlite3 (#5133) 2018-10-23 13:28:10 +08:00
Mura LiandJonas Franz 9458880c06 Increase the retry limit to 20 times and the interval to 200ms (#5134)
The original settings has less tolerance and would fail on some
environments.
2018-10-21 16:09:17 +02:00
Mura Liandtechknowlogick 583b1b8429 Retry test-fixtures loading in case of transaction rollback (#5125) 2018-10-20 16:48:33 -04:00
Mura Liandtechknowlogick dba955be7c Upgrade gopkg.in/testfixtures.v2 (#4999) 2018-10-02 15:20:02 -04:00
Mura LiandLunny Xiao f4d12f8d97 Fix run command race (#1470)
* Use exec.CommandContext to simplfy timeout handling

And fixing the data races which can be identified by the added tests when -race enabled.

* Use sleep commmand instead of reading from stdin

* Make the error handling go-esque
2017-11-13 22:51:45 +08:00
Mura LiandLunny Xiao 754482bf5d Add integration test for repository migration (#1983) 2017-06-20 19:23:16 +08:00
Mura LiandLunny Xiao 4d2ea7dc41 Add integration test for issue creating (#2002) 2017-06-18 21:25:58 +08:00
Mura LiandLunny Xiao 01322af2e8 Add integration test for pull-request merge (#1912) 2017-06-15 19:20:39 +08:00
Mura LiandBo-Yi Wu 033aaf4b38 Add pull-create integration test (#1972) 2017-06-15 02:01:51 -05:00
Mura LiandLunny Xiao 662b8bc2a2 Add integration test for file editing (#1907) 2017-06-08 19:15:41 +08:00
Mura LiandLunny Xiao edbb9eefd6 Fix race when running commands with timeout (#1465)
Update vendored module code.gitea.io/git
2017-04-07 19:23:39 -07:00
Mura LiandBo-Yi Wu 2d1efcc270 Add GOFLAGS and EXTRA_GOFLAGS (#1438) 2017-04-05 16:10:32 +08:00
Mura LiandLunny Xiao b746757209 Remove unused mutex field (#1440) 2017-04-04 01:54:02 -07:00
Mura LiandBo-Yi Wu 93c25c9a35 Fix races in the log module by using syncmap (#1421) 2017-04-03 10:22:26 +08:00
Mura LiandBo-Yi Wu 6a39250579 Add length check for the return string (#1420)
* Add length check for the return string

* Differentiate error paths and logging messages

* Rectify error message
2017-03-31 16:42:23 +08:00
Mura LiandLunny Xiao bdcc1a23e0 Add integration test for signup (#1135)
* Add integration test for signup

* Remove unused functions

* Refactoring

* Add repo_create_test.go

* Rollback the incomplete repo create test

* Comply with linter requirements and simplify the code a little bit
2017-03-11 22:30:29 +08:00
Mura LiandLunny Xiao 288226e13c Fix stray directories generated by integration tests (#1134) 2017-03-07 15:38:26 +08:00
Mura LiandLunny Xiao 848293671b Add basic integration test infrastructure (and new endpoint /api/v1/version for testing it) (#741)
* Implement '/api/v1/version'

* Cleanup and various fixes

* Enhance run.sh

* Add install_test.go

* Add parameter utils.Config for testing handlers

* Re-organize TestVersion.go

* Rename functions

* handling process cleanup properly

* Fix missing function renaming

* Cleanup the 'retry' logic

* Cleanup

* Remove unneeded logging code

* Logging messages tweaking

* Logging message tweaking

* Fix logging messages

* Use 'const' instead of hardwired numbers

* We don't really need retries anymore

* Move constant ServerHttpPort to install_test.go

* Restore mistakenly removed constant

* Add required comments to make the linter happy.

* Fix comments and naming to address linter's complaints

* Detect Gitea executale version automatically

* Remove tests/run.sh, `go test` suffices.

* Make `make build` a prerequisite of `make test`

* Do not sleep before trying

* Speedup the server pinging loop

* Use defined const instead of hardwired numbers

* Remove redundant error handling

* Use a dedicated target for running code.gitea.io/tests

* Do not make 'test' depend on 'build' target

* Rectify the excluded package list

* Remove redundant 'exit 1'

* Change the API to allow passing test.T to test handlers

* Make testing.T an embedded field

* Use assert.Equal to comparing results

* Add copyright info

* Parametrized logging output

* Use tmpdir instead

* Eliminate redundant casting

* Remove unneeded variable

* Fix last commit

* Add missing copyright info

* Replace fmt.Fprintf with fmt.Fprint

* rename the xtest to integration-test

* Use Symlink instead of hard-link for cross-device linking

* Turn debugging logs on

* Follow the existing framework for APIs

* Output logs only if test.v is true

* Re-order import statements

* Enhance the error message

* Fix comment which breaks the linter's rule

* Rename 'integration-test' to 'e2e-test' for saving keystrokes

* Add comment to avoid possible confusion

* Rename tests -> integration-tests

Also change back the Makefile to use `make integration-test`.

* Use tests/integration for now

* tests/integration -> integrations

Slightly flattened directory hierarchy is better.

* Update Makefile accordingly

* Fix a missing change in Makefile

* govendor update code.gitea.io/sdk/gitea

* Fix comment of struct fields

* Fix conditional nonsense

* Fix missing updates regarding version string changes

* Make variable naming more consistent

* Check http status code

* Rectify error messages
2017-03-06 22:13:17 +08:00
typelessandLunny Xiao 937b4b5aa1 Speed up conflict checking in pull request creation (#276)
* Speed up conflict checking in pull request creation

In order to check conflicts of a PR, we set up a working tree by
cloning the base branch, which is quite time-consuming when the repository is huge.
Instead, this PR uses `git read-tree` and `git apply --check --cached` to check conflicts.

For #258

* Use $GIT_INDEX_FILE instead of --index-output to avoid lockfile problem

The lockfile gets renamed to the final destination after the operation
finishes. But it must be located in the same filesystem, which prevents
us from using /tmp.

* Temporary file names should not prefixed with '-'
2016-12-29 22:59:52 +08:00