Commit Graph
29 Commits
Author SHA1 Message Date
zeripathandGitHub cc8a7c9345 Git 2.28 no longer permits diff with ... on unrelated branches (#12370)
Backport #12364

Signed-off-by: Andrew Thornton <[email protected]>
2020-07-29 12:42:22 -04:00
320031fce6 Handle more pathological branch and tag names (#11843) (#11863)
Backport #11843

It's possible to push quite pathological appearing branch names to gitea
using git push gitea reasonable-branch:refs/heads/-- at which point
large parts of the UI will break. Similarly you can git push origin
reasonable-tag:refs/tags/-- which wil return an error.

This PR fixes the problems these cause. It also changes the code from
creating branches to pushing to ensure that branch restoration has to
pass hooks.

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

Co-authored-by: techknowlogick <[email protected]>
2020-06-12 14:01:44 -04:00
052bff0cff Convert plumbing.ErrObjectNotFound to git.ErrNotExist in getCommit (#10862)
Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: guillep2k <[email protected]>
Co-authored-by: Antoine GIRARD <[email protected]>
2020-03-28 20:59:21 +02:00
Lauris BHandGitHub 43c09134a9 Migrate to go-git/go-git v5.0.0 (#10735) 2020-03-17 12:19:58 -04:00
zeripathandGitHub 3fc4f3670c Fix panic in API pulls when headbranch does not exist (#10676)
* Fix panic in API pulls when headbranch does not exist
* refix other reference to plumbing.ErrReferenceNotFound

Signed-off-by: Andrew Thornton <[email protected]>
2020-03-09 07:06:38 +00:00
Lauris BHandGitHub 852aeeffc0 Fix commit between two commits calculation if there is only last commit (#10225) 2020-02-11 01:04:43 +02:00
1f01f53c53 API add/generalize pagination (#9452)
* paginate results

* fixed deadlock

* prevented breaking change

* updated swagger

* go fmt

* fixed find topic

* go mod tidy

* go mod vendor with go1.13.5

* fixed repo find topics

* fixed unit test

* added Limit method to Engine struct; use engine variable when provided; fixed gitignore

* use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors

* set Page value on Home route

* improved memory allocations

* fixed response headers

* removed logfiles

* fixed import order

* import order

* improved swagger

* added function to get models.ListOptions from context

* removed pagesize diff on unit test

* fixed imports

* removed unnecessary struct field

* fixed go fmt

* scoped PR

* code improvements

* code improvements

* go mod tidy

* fixed import order

* fixed commit statuses session

* fixed files headers

* fixed headers; added pagination for notifications

* go mod tidy

* go fmt

* removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list

* Apply suggestions from code review

Co-Authored-By: 6543 <[email protected]>
Co-Authored-By: zeripath <[email protected]>

* fixed build error

* CI.restart()

* fixed merge conflicts resolve

* fixed conflicts resolve

* improved FindTrackedTimesOptions.ToOptions() method

* added backwards compatibility on ListReleases request; fixed issue tracked time ToSession

* fixed build error; fixed swagger template

* fixed swagger template

* fixed ListReleases backwards compatibility

* added page to user search route

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: zeripath <[email protected]>
2020-01-24 14:00:29 -05:00
0c07f1de5b Provide Default messages for merges (#9393)
Co-Authored-By: guillep2k <[email protected]>
2019-12-30 18:34:11 -05:00
Gary Kimandtechknowlogick ee11974719 Search Commits via Commit Hash (#7400)
* search commits via commit hash

Signed-off-by: Gary Kim <[email protected]>

* Also include all option for hash search

Signed-off-by: Gary Kim <[email protected]>

* Remove code duplication in commit search

Signed-off-by: Gary Kim <[email protected]>

* Add case ignore to commit hash search

Signed-off-by: Gary Kim <[email protected]>
2019-09-02 19:38:04 -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
Christian Muehlhaeuserandzeripath 54d96c79b5 Removed unnecessary conversions (#7557)
No need to convert to the same type.
2019-07-23 19:50:39 +01:00
CherrgandLunny Xiao a7b1ba0e3d wiki history improvements (#7391)
* add history comments to detect page delete

Signed-off-by: Michael Gnehr <[email protected]>

* fix too much history entries
- caused by --follow flag
  - if files with same contents exists

Signed-off-by: Michael Gnehr <[email protected]>

* style imprevements wiki
- history - wrap long author names

Signed-off-by: Michael Gnehr <[email protected]>
2019-07-11 22:45:10 +08:00
kolaenteandtechknowlogick f9ec2f89f2 Add golangci (#6418) 2019-06-12 15:41:28 -04:00
Mario Lubenkaandtechknowlogick 311ce2d1d0 Compare branches, commits and tags with each other (#6991)
* Supports tags when comparing commits or branches

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

* Hide headline when only comparing and don't load unused data

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

* Merges compare logics to allow comparing branches, commits and tags with eachother

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

* Display branch or tag instead of commit when used for comparing

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

* Show pull request form after click on button

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

* Transfers relevant pull.go changes from master to compare.go

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

* Fixes error when comparing forks against a commit or tag

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

* Removes console.log from JavaScript file

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

* Show icon next to commit reference when comparing branch or tag

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

* Updates css file

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

* Fixes import order

* Renames template variable

* Update routers/repo/compare.go

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

* Update from master

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

* Allow short-shas in compare

* Renames prInfo to compareInfo

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

* Check PR permissions only if compare is pull request

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

* Adjusts comment

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

* Use compareInfo instead of prInfo
2019-06-07 16:29:29 -04: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
Richard Mahnandtechknowlogick 2262811e40 Fixes 4762 - Content API for Creating, Updating, Deleting Files (#6314) 2019-04-17 12:06:35 -04: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
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 3a81fdf092 rename fields 2015-11-03 22:49:06 -05:00
Unknwon c6ce6bd4c2 work on #1830 2015-10-23 10:31:13 -04:00
Unknwon 953bb06857 basic PR feature 2015-09-02 09:26:56 -04:00
Unknwon aa65761d81 new commits table 2015-08-20 20:18:49 +08:00
Unknwon 2a031c1365 Fix #515 2014-09-30 04:39:53 -04:00
Unknwon 62f21ff3ed Work on #476 2014-09-16 11:29:53 -04:00
Unknwon 0d9c41be7d Work on #476 2014-09-16 10:10:33 -04:00
Unknwon 9a1d5d2489 Finish new web hook pages 2014-08-09 15:40:10 -07:00
Unknwon 5c4bc3c848 Huge updates!!!!! Be careful to merge!!!! 2014-07-26 02:28:04 -04:00
Unknwon 8dd07c0ddd New UI merge in progress 2014-07-26 00:24:27 -04:00