Commit Graph

143 Commits

Author SHA1 Message Date
Lin Jen-Shin 3e6a527e68 Add tests for Commit#status and Commit#status_for, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7034#note_17543036
2016-10-28 03:47:49 +08:00
tiagonbotelho c90483406e refactors tests because of gitlab-test repository changes 2016-10-11 16:33:06 +01:00
Clement Ho e4c517a635 Expand commit message width in repo view 2016-08-02 11:40:44 -05:00
Stan Hu d27e36f35a Add specs for caching commit author 2016-07-27 16:42:38 -07:00
Rémy Coutable 939436480c Ensure relative paths for video are rewritten as we do for images
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-26 10:22:17 +02:00
Alejandro Rodríguez ca696175db Optimize Banzai::Filter::RelativeLinkFilter
A lot of git operations were being repeated, for example, to build a url
    you would ask if the path was a Tree, which would call a recursive routine
    in Gitlab::Git::Tree#where, then ask if the path was a Blob, which would
    call a recursive routine at Gitlab::Git::Blob#find, making reference to
    the same git objects several times. Now we call Rugged::Tree#path, which
    allows us to determine the type of the path in one pass.

    Some other minor improvement added, like saving commonly used references
    instead of calculating them each time.
2016-06-21 10:53:16 -04:00
Yorick Peterse 580d250166
Refactor Participable
There are several changes to this module:

1. The use of an explicit stack in Participable#participants
2. Proc behaviour has been changed
3. Batch permissions checking

== Explicit Stack

Participable#participants no longer uses recursion to process "self" and
all child objects, instead it uses an Array and processes objects in
breadth-first order. This allows us to for example create a single
Gitlab::ReferenceExtractor instance and pass this to any Procs. Re-using
a ReferenceExtractor removes the need for running potentially many SQL
queries every time a Proc is called on a new object.

== Proc Behaviour Changed

Previously a Proc in Participable was expected to return an Array of
User instances. This has been changed and instead it's now expected that
a Proc modifies the Gitlab::ReferenceExtractor passed to it. The return
value of the Proc is ignored.

== Permissions Checking

The method Participable#participants uses
Ability.users_that_can_read_project to check if the returned users have
access to the project of "self" _without_ running multiple SQL queries
for every user.
2016-06-01 16:22:35 +02:00
Gabriel Mazetto f5a0ac0fc1 Codestyle: make sure we have space around operators 2016-05-13 04:46:56 -03:00
Kamil Trzcinski 0b1655e7b2 Rename CiStatus to Statusable 2016-04-16 21:46:26 +02:00
Douglas Barbosa Alexandre 43d8bdb4f0 Restrict access to references for confidential issues 2016-03-17 20:55:59 -03:00
Rémy Coutable 96ed5c5114 Ensure we don't check a commit's description for revert message if it has no description 2016-02-22 18:33:02 +01:00
Douwe Maan 1e8d703a85 Tag model specs 2015-12-09 10:50:51 +01:00
Valery Sizov bd5fb1b479 Merge branch 'webhook_payload_with_changes' into 'master'
Add added, modified and removed properties to commit object in webhook

https://gitlab.com/gitlab-org/gitlab-ee/issues/20

See merge request !1988
2015-12-07 14:43:13 +00:00
Valery Sizov 3c97cbc74c fixes after review 2015-12-07 15:13:06 +02:00
Valery Sizov 5df2c4419c fox specs 2015-12-07 14:14:35 +02:00
Valery Sizov 5c1b49f494 Add added, modified and removed properties to commit object in webhook 2015-12-04 16:23:21 +02:00
Douwe Maan 62c14ba2ed Render commit reference using short sha, but include full sha in comment. 2015-12-01 12:58:45 +01:00
Douwe Maan 4a0ebccf6b Fix specs 2015-11-30 22:43:54 +01:00
Douwe Maan 6f35614852 Fix mentionable specs 2015-10-12 16:23:15 +02:00
Robert Speicher 5a9ede4721 Update mock and stub syntax for specs 2015-06-22 12:13:46 +02:00
Robert Speicher c0faf91ff2 Add `to_reference` for models that support references
Now there is a single source of information for which attribute a model
uses to be referenced, and its special character.
2015-05-26 15:48:30 -04:00
Douwe Maan 27af24c1c9 No longer needed to pass project argument to commit methods. 2015-04-24 12:29:36 +02:00
Douwe Maan 8ed7ac9d44 Use project.commit convenience method. 2015-04-24 12:29:36 +02:00
Robert Speicher 8c9a148720 Update mentionable shared examples to be (a bit) more understandable 2015-04-16 16:30:16 -04:00
Robert Speicher dee52393b5 Correct usage of `subject` in specs 2015-04-16 16:30:16 -04:00
Douwe Maan 5662b24132 Don't use HTML ellipsis in EmailsOnPush subject truncated commit message. 2015-04-14 16:32:11 +02:00
Jeroen van Baarsen 0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
jubianchi b21a2d821a Allow commit messages to close several issues at once (thanks @123Haynes
for his work and help)
2015-01-20 10:45:48 +01:00
Dmitriy Zaporozhets ea04ed7879
Use 8chars short sha for commit in views
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-10-10 16:30:14 +03:00
Dmitriy Zaporozhets 0189be0831
Use short_id instead of [0..N] for short version of commit sha
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-10-10 15:39:48 +03:00
Vinnie Okada 088987e2dd Make Mentionables work for cross-project refs
Add a note to merge requests and issues when they're mentioned by a
merge request, issue, or commit in another project.
2014-10-03 12:30:20 -05:00
Dmitriy Zaporozhets 4710a76a8d
Fix commit specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-08-01 18:06:28 +03:00
Dmitriy Zaporozhets c227aa44f9
Make changes to tests
* project_with_code -> project
* project -> ermpty_project

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-22 21:03:52 +02:00
ash wilson c8a115c0e3 Link issues from comments and automatically close them
Any mention of Issues, MergeRequests, or Commits via GitLab-flavored markdown
references in descriptions, titles, or attached Notes creates a back-reference
Note that links to the original referencer. Furthermore, pushing commits with
commit messages that match a (configurable) regexp to a project's default
branch will close any issues mentioned by GFM in the matched closing phrase.
If accepting a merge request would close any Issues in this way, a banner is
appended to the merge request's main panel to indicate this.
2013-08-25 18:58:41 -04:00
Dmitriy Zaporozhets 7825830ca5 Allow project name, path etc start with number. Fixed specs 2013-08-13 12:24:10 +03:00
Izaak Alpert 3d7194f011 Merge Request on forked projects
The good:

 - You can do a merge request for a forked commit and it will merge properly (i.e. it does work).
 - Push events take into account merge requests on forked projects
 - Tests around merge_actions now present, spinach, and other rspec tests
 - Satellites now clean themselves up rather then recreate

The questionable:

 - Events only know about target projects
 - Project's merge requests only hold on to MR's where they are the target
 - All operations performed in the satellite

The bad:

  -  Duplication between project's repositories and satellites (e.g. commits_between)

(for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos)

Fixes:

Make test repos/satellites only create when needed
-Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap)
-project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually
-fixed remote removal
-How to merge renders properly
-Update emails to show project/branches
-Edit MR doesn't set target branch
-Fix some failures on editing/creating merge requests, added a test
-Added back a test around merge request observer
-Clean up project_transfer_spec, Remove duplicate enable/disable observers
-Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well
-Signifant speed ups for tests
-Update formatting ordering in notes_on_merge_requests
-Remove wiki schema update
Fixes for search/search results
-Search results was using by_project for a list of projects, updated this to use in_projects
-updated search results to reference the correct (target) project
-udpated search results to print both sides of the merge request

Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-07-17 22:41:30 -04:00
Dmitriy Zaporozhets dfeef6c228 Fixed API file raw functionality, Fixed tree controller tests. Added BlobController specs 2013-04-03 15:55:08 +03:00
Dmitriy Zaporozhets 9a26e9a0d6 Dont init repo on every create(:repo) 2013-04-01 17:27:44 +03:00
Dmitriy Zaporozhets 541d899410 Project.repository should never be nil so you can call repository.exists? or repository.empty?
Also specify separate project factory for project with filled repo
2013-04-01 16:56:25 +03:00
Dmitriy Zaporozhets 9dc644635f Fix tests and remove app/models/repository.rb 2013-03-31 18:50:17 +03:00
Dmitriy Zaporozhets ef5b36eaaf Fixed protected branches and file edit 2013-01-04 21:45:30 +02:00
Dmitriy Zaporozhets e6c0673ef1 Rspec models Milestone, Commit, UsersProject 2013-01-03 19:11:14 +02:00
Robert Speicher 5e3be9cda0 Cache the value of safe_message
Also, just for extra paranoia, only call safe_message once in the
decorator methods

Adds specs to make sure it still works
2012-10-02 19:00:41 -04:00