Commit Graph

125 Commits

Author SHA1 Message Date
GitLab Bot eb8836dea4 Add latest changes from gitlab-org/gitlab@master 2020-12-21 12:10:22 +00:00
GitLab Bot 83fc2f3dc8 Add latest changes from gitlab-org/gitlab@master 2020-07-08 21:09:09 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 5781a49660 Add latest changes from gitlab-org/gitlab@master 2020-03-12 00:09:34 +00:00
GitLab Bot 47ebeef912 Add latest changes from gitlab-org/gitlab@master 2020-03-11 00:09:09 +00:00
GitLab Bot 0ab47b994c Add latest changes from gitlab-org/gitlab@master 2020-02-13 15:08:52 +00:00
GitLab Bot 6168721025 Add latest changes from gitlab-org/gitlab@master 2020-02-07 00:09:12 +00:00
GitLab Bot 20d564f106 Add latest changes from gitlab-org/gitlab@master 2020-02-05 12:09:15 +00:00
GitLab Bot c158fa8d69 Add latest changes from gitlab-org/gitlab@master 2020-01-16 12:08:32 +00:00
GitLab Bot 2b3bfe8fc5 Add latest changes from gitlab-org/gitlab@master 2020-01-08 00:07:43 +00:00
GitLab Bot ccf37fd3ec Add latest changes from gitlab-org/gitlab@master 2019-12-18 15:08:03 +00:00
GitLab Bot 4e375367b7 Add latest changes from gitlab-org/gitlab@master 2019-12-07 00:07:51 +00:00
GitLab Bot ab7cf450ba Add latest changes from gitlab-org/gitlab@master 2019-12-03 18:06:49 +00:00
GitLab Bot 0a850868df Add latest changes from gitlab-org/gitlab@master 2019-10-09 12:06:13 +00:00
GitLab Bot 538fff823d Add latest changes from gitlab-org/gitlab@master 2019-09-30 15:08:09 +00:00
Stan Hu 29ce13e999 Fix moving issues API failing when text includes commit URLs
When a issue is moved from one project to another, all associated
Markdown text is rewritten in the context of the new project. If the
note contained a link to a commit URL, `CommitRewriter#rewrite` would
fail because `Commit#link_reference_pattern` would match `nil` `commit`
values in the HTML generated from the Markdown. These `nil` values were
passed along to `Project#commits_by` because `Commit#reference_valid?`
was always returning `true`.

To prevent this issue from happening, we tighten up the check for
`Commit#reference_valid?` to look for valid SHA values.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66666
2019-08-28 00:18:33 -07:00
Heinrich Lee Yu 3b1da9be25 Fix inline rendering of SVGs from current repo
Changes generated URL to raw instead of blob
2019-08-02 06:34:20 +08:00
Stan Hu 18020f00f8 Speed up commit loads by disabling BatchLoader replace_methods
We've seen a significant performance penalty when using
`BatchLoader#__replace_with!`. This defines methods on the batch loader
that proxy to the 'real' object using send. The alternative is
`method_missing`, which is slower.  However, we've noticed that
`method_missing` can be faster if:

1. The objects being loaded have a large interface.
2. We don't call too many methods on the loaded object.

In production, we've seen the rendering times of the merge request
widget increase as a result of loading commit data. BatchLoader attempts
to call replace_methods on the lazy object, but this has a significant
performance penalty. Disabling this mode
(https://github.com/exAspArk/batch-loader/pull/45) appears to cut load
times by about 50% for MergeRequestsController#show.

Relates to https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/6941
2019-06-13 14:21:23 -07:00
Thong Kuah a2cfc150ce Add # frozen_string_literal to spec/models
Adds `# frozen_string_literal: true` to spec/models ruby files
2019-04-01 14:37:54 +13:00
Stan Hu 4ee08fd1f7 Add back Rugged support for retrieving a commit tree entry
This brings back some of the changes in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20176/diffs.

We discovered another N+1 that hits Gitaly `TreeEntry` via the
`RelativeLinkFilter`:
https://gitlab.com/gitlab-org/gitlab-ce/issues/58657. When a blob is
loaded with many relative links, `TreeEntry` is called for each link to
scan the URI type.

There are multiple paths that hit Gitaly `TreeEntry`, and
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25706 did not
cover all cases. This commit covers another common use case.

For users using Gitaly on top of NFS, accessing the Git data directly
via Rugged may be faster than going through than Gitaly. This merge
request introduces the feature flag `rugged_commit_tree_entry` to
activate the Rugged method.
2019-03-08 16:01:59 -08:00
Kamil Trzciński d4c7214799
[master] Pipelines section is available to unauthorized users 2019-01-31 16:52:50 +01:00
Stan Hu 7d18c4d236 Truncate merge request titles with periods instead of ellipsis
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54862
2018-12-06 21:51:51 -08:00
Nick Thomas 59c4fb4ecb
Match users better by their private commit email
Private commit emails were introduced in !22560, but some parts of
GitLab were not updated to take account of them. This commit adds
support in places that were missed.
2018-11-19 12:45:07 +00:00
Rémy Coutable 4ca1afec35 Merge branch 'fix-committer-typo' into 'master'
Fix committer typo

Closes #51808

See merge request gitlab-org/gitlab-ce!21899
2018-09-25 17:08:23 +00:00
George Tsiolis f611493912 Fix committer typo 2018-09-25 11:51:07 +03:00
Michael Kozono a54a5d9f39 Use `Gitlab::SafeRequestStore` in more places
Even if it doesn’t save lines of code, since people will tend to use
code they’ve seen. And `SafeRequestStore` is safer since you
don’t have to remember to check `RequestStore.active?`.
2018-09-24 12:11:27 -07:00
Sean McGivern 5759bfe029 Make it clearer when Commit#description returns no_commit_message 2018-08-21 11:41:25 +01:00
yisiliang 0d642e1e3c to avoid “NoMethodError (undefined method `split' for nil:NilClass)” while safe_message is nil. 2018-08-21 10:41:47 +01:00
Jacob Vosmaer 33c950f293 Client-side fix for Gitaly TreeEntry bug 2018-06-26 14:12:08 +02:00
Yorick Peterse 19428e8008
Preload pipeline data for project pipelines
When displaying the pipelines of a project we now preload the following
data:

1. Authors of the commits that belong to these pipelines
2. The number of warnings per pipeline, which is used by
   Ci::Pipeline#has_warnings?

== Commit Authors

Previously this data was queried for every Commit separately, leading to
20 SQL queries being executed in the worst case. With an average of 3 to
5 milliseconds per SQL query this could result in 100 milliseconds being
spent in _just_ getting Commit authors.

To preload this data Commit#author now uses BatchLoader (through
Commit#lazy_author), and a separate module
Gitlab::Ci::Pipeline::Preloader is used to ensure all authors are loaded
before they are used.

== Number of warnings

This changes Ci::Pipeline#has_warnings? so it supports preloading of the
number of warnings per pipeline. This removes the need for executing a
COUNT(*) query for every pipeline just to see if it has any warnings or
not.
2018-05-17 13:53:00 +02:00
Zeger-Jan van de Weg dfdd881510
Workhorse to send raw diff and patch for commits
Prior to this change, this was done through unicorn. In theory this
could time out. Workhorse has been sending these raw patches and diffs
for a long time and is stable in doing so.

Added bonus is the fact that `Commit#to_patch` can be removed.

`Commit#to_diff` too, which closes
https://gitlab.com/gitlab-org/gitaly/issues/324

Closes https://gitlab.com/gitlab-org/gitaly/issues/1196
2018-05-16 11:52:43 +02:00
Zeger-Jan van de Weg e02f1271f5
Return nil on empty path
The execution path wasn't clear from the error, but either way this is a
fix.

Closes gitlab-org/gitaly#1115
2018-04-17 16:30:18 +02:00
Nick Thomas 7b276a1076
Fix an order dependency in a spec 2018-01-29 16:18:31 +00:00
Ahmad Sherif f32f04a50f Migrate Commit#uri_type to Gitaly
Closes gitaly#915
2018-01-15 14:16:22 +01:00
Hiroyuki Sato a7d26f00c3 Display related merge requests in commit detail page 2018-01-12 20:38:36 +00:00
Jacob Vosmaer ac2cb65ab3 Remove the Commit#tree method 2018-01-04 18:00:28 +01:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
Zeger-Jan van de Weg c6edae3887
Load commit in batches for pipelines#index
Uses `list_commits_by_oid` on the CommitService, to request the needed
commits for pipelines. These commits are needed to display the user that
created the commit and the commit title.

This includes fixes for tests failing that depended on the commit
being `nil`. However, now these are batch loaded, this doesn't happen
anymore and the commits are an instance of BatchLoader.
2017-12-19 10:05:40 +01:00
Yorick Peterse ab16a6fb34
Optimise getting the pipeline status of commits
This adds an optimised way of getting the latest pipeline status for a
list of Commit objects (or just a single one).
2017-11-16 16:01:14 +01:00
Jacob Vosmaer 902b5347dc Prepare Repository#merge for migration to Gitaly 2017-09-15 16:39:20 +02:00
Saverio Miroddi 934eef7290 Improve description of a Commit#cherry_pick_message UT 2017-08-22 22:20:22 +02:00
Saverio Miroddi 7a8a8e0764 Fix rubocop errors in spec/models/commit_spec.rb 2017-08-21 22:13:41 +02:00
Saverio Miroddi e6220c018e Add UT for cherry-pick of an existing merge that is not found 2017-08-21 21:05:11 +02:00
Saverio Miroddi 9ec358af7b Reverse order of commits in MR cherry-pick message
Also improved the UT for better documenting this change.
2017-08-21 20:47:18 +02:00
Saverio Miroddi b4622c772e Remove redundant statement part in a test suite 2017-08-18 08:30:14 +02:00
Saverio Miroddi c0f921606c Correct the cherry-pick message for merge commits
The list of commits must be generated from the merge request,
not from a diff of the branches.
2017-08-17 22:38:47 +02:00
Saverio Miroddi 919c0c7ba7 Extended UTs for the new cherry-pick message format 2017-08-16 13:18:07 +02:00
Alejandro Rodríguez 3ce6f03f14 Incorporate Gitaly's CommitService.FindCommit RPC 2017-08-07 23:33:43 -04:00
Alejandro Rodríguez c21ae07e33 Refactor Gitlab::Git::Commit to include a repository 2017-08-07 22:34:34 -04:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00