Commit Graph

3197 Commits

Author SHA1 Message Date
Douwe Maan 3f05c22f56 Merge branch 'rs-git-bin-path' into 'master'
Replace all usages of `git` command with configurable binary path

Closes #3311

See merge request !1742
2015-11-04 15:03:16 +00:00
Yorick Peterse 6d91ee0095 Merge branch 'create-project-performance' into 'master'
Improve performance of creating projects



See merge request !1650
2015-11-04 10:14:30 +00:00
Yorick Peterse 219f920c64 Merge branch 'remove-duplicate-orders' into 'master'
Remove duplicate orders

This changes the default order from `created_at DESC, id DESC` to just `id DESC` as this achieves the same results without the overhead of having to sort data twice (we've seen queries go from 200ms to just a few ms by removing the double sort).

cc @jacobvosmaer @dzaporozhets @rspeicher @DouweM 

See merge request !1735
2015-11-04 10:14:08 +00:00
Robert Speicher d09d62b6b8 Replace all usages of `git` command with configurable binary path
Closes #3311
2015-11-03 17:11:09 -05:00
Kamil Trzciński 77ef4855e0 Merge branch 'drop-old-builds' into 'master'
Cleanup stuck CI builds

Fixes #3143

/cc @dzaporozhets @jacobvosmaer 

See merge request !1655
2015-11-03 13:56:43 +00:00
Valery Sizov b12e17ff55 Merge branch 'web_hook_repo_changes' 2015-11-03 15:05:50 +02:00
Kamil Trzciński 86c0d8d289 Merge branch 'only-syntax' into 'master'
Extend yml syntax for only and except to support specifying repository path

This allows to limit execution of jobs to specific repository.

For example:
```yaml
job:
  only:
    - branches@gitlab-org/gitlab-ce
  except:
    - master@gitlab-org/gitlab-ce
```

The above will run `job` for all branches on `gitlab-org/gitlab-ce`, except master.

@dzaporozhets @JobV @vsizov Please review.


See merge request !1720
2015-11-03 12:13:21 +00:00
Kamil Trzcinski 8d2758e02d Cleanup stuck CI builds daily 2015-11-03 13:12:16 +01:00
Dmitriy Zaporozhets d23ffc832c
Fix code that depends on incorrect inflector behavior
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-11-03 12:00:27 +01:00
Yorick Peterse a2f8f9ad3d Fixed User sorting specs
The descriptions were not accurate and one particular spec seemingly
expected the wrong User row to be returned.
2015-11-03 11:56:04 +01:00
Yorick Peterse 0df65909ef Added benchmark for User.all
This benchmark exists to test if ordering has any noticeable impact in
the test environment.
2015-11-03 11:47:23 +01:00
Dmitriy Zaporozhets fb2f8be4d7 Merge branch 'olhado/gitlab-ce-commit-search' 2015-11-03 11:28:56 +01:00
Valery Sizov 9479496f75 Add added, modified and removed properties to commit object in webhook 2015-11-03 12:16:40 +02:00
Kamil Trzcinski fe34b745e7 Fix tests 2015-11-03 11:05:54 +01:00
Dmitriy Zaporozhets 5782217bfc Merge branch 'api_file_touched_at' into 'master'
Add ability to fetch the commit ID of the last commit that actually touched a file

https://dev.gitlab.org/gitlab/gitlabhq/issues/2564

See merge request !1718
2015-11-02 17:58:32 +00:00
Dmitriy Zaporozhets 810c91fe35
Refactor search by commits message
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-11-02 16:39:24 +01:00
Valery Sizov 1b8d324762 Add ability to fetch the commit ID of the last commit that actually touched a file 2015-11-02 17:07:06 +02:00
Kamil Trzcinski c03da1caad Extend yml syntax for only and except to support specifying repository path 2015-11-02 14:44:06 +01:00
Kamil Trzciński edab429c97 Merge branch 'backup-improvements' into 'master'
Reduce disk IO and space usage during backups

This is based on improvements made to the GitLab CI 8.0 backup script.

- Avoid creating many small intermediate files while backing up builds and uploads by using tar and light gzip compression
- Use same backup/restore code for uploads and builds
- Only store a compressed intermediate DB dump

See merge request !1520
2015-11-02 13:02:25 +00:00
Douwe Maan 329e067ff1 Merge branch 'rs-dev-issue-2613' into 'master'
Add custom protocol whitelisting to SanitizationFilter

Addresses internal https://dev.gitlab.org/gitlab/gitlabhq/issues/2613

We allow any protocol for autolinks: irc://irc.freenode.net/git

But manual Markdown links with the same protocol get sanitized: `[This will not be clickable](irc://irc.freenode.net/git)`: [This will not be clickable](irc://irc.freenode.net/git)

To get around this we have to first allow *all* protocols, and then manually clean dangerous (i.e., `javascript:`) protocols.

See merge request !1496
2015-11-02 10:49:46 +00:00
Yorick Peterse 6d3068bec3 Adjusted ips/sec for find_by_any_email benchmarks
While these benchmarks run at roughly 1500 i/sec setting the threshold
to 1000 leaves some room for deviations (e.g. due to different DB
setups).
2015-10-30 12:00:58 +01:00
Yorick Peterse 49c081b9f3 Improve performance of User.find_by_any_email
This query used to rely on a JOIN, effectively producing the following
SQL:

    SELECT users.*
    FROM users
    LEFT OUTER JOIN emails ON emails.user_id = users.id
    WHERE (users.email = X OR emails.email = X)
    LIMIT 1;

The use of a JOIN means having to scan over all Emails and users, join
them together and then filter out the rows that don't match the criteria
(though this step may be taken into account already when joining).

In the new setup this query instead uses a sub-query, producing the
following SQL:

    SELECT *
    FROM users
    WHERE id IN (select user_id FROM emails WHERE email = X)
    OR email = X
    LIMIT 1;

This query has the benefit that it:

1. Doesn't have to JOIN any rows
2. Only has to operate on a relatively small set of rows from the
   "emails" table.

Since most users will only have a handful of Emails associated
(certainly not hundreds or even thousands) the size of the set returned
by the sub-query is small enough that it should not become problematic.

Performance of the old versus new version can be measured using the
following benchmark:

    # Save this in ./bench.rb
    require 'benchmark/ips'

    email = 'yorick@gitlab.com'

    def User.find_by_any_email_old(email)
      user_table = arel_table
      email_table = Email.arel_table

      query = user_table.
        project(user_table[Arel.star]).
        join(email_table, Arel::Nodes::OuterJoin).
        on(user_table[:id].eq(email_table[:user_id])).
        where(user_table[:email].eq(email).or(email_table[:email].eq(email)))

      find_by_sql(query.to_sql).first
    end

    Benchmark.ips do |bench|
      bench.report 'original' do
        User.find_by_any_email_old(email)
      end

      bench.report 'optimized' do
        User.find_by_any_email(email)
      end

      bench.compare!
    end

Running this locally using "bundle exec rails r bench.rb" produces the
following output:

    Calculating -------------------------------------
                original     1.000  i/100ms
               optimized    93.000  i/100ms
    -------------------------------------------------
                original     11.103  (± 0.0%) i/s -     56.000
               optimized    948.713  (± 5.3%) i/s -      4.743k

    Comparison:
               optimized:      948.7 i/s
                original:       11.1 i/s - 85.45x slower

In other words, the new setup is 85x faster compared to the old setup,
at least when running this benchmark locally.

For GitLab.com these improvements result in User.find_by_any_email
taking only ~170 ms to run, instead of around 800 ms. While this is
"only" an improvement of about 4.5 times (instead of 85x) it's still
significantly better than before.

Fixes #3242
2015-10-30 12:00:58 +01:00
Yorick Peterse 6369c992a6 Added benchmark for Projects::CreateService
This benchmark currently runs at ~0.6 iterations per second and is
unlikely to perform any better any time soon.
2015-10-29 12:09:25 +01:00
Michael Chmielewski a0d0a01791 Actually converted code to following suggestions. 2015-10-28 22:34:39 -04:00
Michael Chmielewski 7b62791afc Fixed method to use git log via Popen as recommended, and made output match test (and thus system) expectations. 2015-10-28 22:34:39 -04:00
Michael Chmielewski b1f4aaa5e7 Trying to incorporate suggestions from comments on Merge Request 1661 2015-10-28 22:34:39 -04:00
Michael Chmielewski 8e8fb87d40 Trailing new lines at ends of files are important. 2015-10-28 22:34:39 -04:00
Mike Chmielewski 091aa95dbf Make subject of spec line up on one line to satisfy rubocop requirements 2015-10-28 22:34:39 -04:00
Jonathan Schoeffling 5a5069969c Add support for searching commit log messages
Include the log messages of recent commits in project-level search
results, providing functionality similar to 'git log --grep'.

Update repository model rspec tests to validate the output of
Repository#commits_with_log_matching.
2015-10-28 22:34:39 -04:00
Dmitriy Zaporozhets c9af886df9
Remove deprecated CI events from project settings page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-10-28 12:33:54 +01:00
Kamil Trzcinski 271ad4e354 Fix CI badge
The previous code relied on having on ref stored in commit, however the ref was moved to the build.
2015-10-26 12:23:40 +01:00
Douwe Maan b6f8d0100e Merge branch 'dirceu/gitlab-ce-fix-project-search-with-unmatched-parentheses' 2015-10-25 11:55:14 +01:00
Robert Speicher 2b51823017 Merge branch 'fix-wiki-clone-over-http' into 'master'
Fix cloning Wiki repositories via HTTP

Cloning a project Wiki over HTTP would end up cloning the main repository
since the .wiki extension was being stripped.

Closes #3106

See merge request !1676
2015-10-23 11:31:01 +00:00
Dmitriy Zaporozhets 3bb39f0e49 Merge branch 'comments_fix' into 'master'
Fix: Inability to reply to code comments in the MR view, if the MR comes from a fork

https://dev.gitlab.org/gitlab/gitlabhq/issues/2535

See merge request !1675
2015-10-23 09:46:18 +00:00
Stan Hu 0e73d7b6af Merge pull request #9762 from huacnlee/fix/api-helpers-bad-autoload-name-for-master
Fix API::APIHelpers -> API::Helpers again for master
2015-10-22 21:12:35 -07:00
Jason Lee 3d613fe1e8 Fix API::APIHelpers -> API::Helpers;
Rails Autoload find file to require is use , APIHelpers -> api_helpers.rb, not helpers.rb;
2015-10-23 11:42:57 +08:00
Stan Hu 69e5e260b0 Add spec for cloning Wiki over HTTP 2015-10-22 14:16:37 -07:00
Valery Sizov 95df86638d Fix: Inability to reply to code comments in the MR view, if the MR comes from a fork 2015-10-22 18:38:00 +02:00
Robert Speicher 7924dd5c9f Merge branch 'project-path-case-sensitivity' into 'master'
Prefer project with exact path to differently cased one when both exist.

Fixes #3113.

See merge request !1649
2015-10-22 13:03:04 +00:00
Kamil Trzcinski 2305483d7d Require jobs to be named 2015-10-22 10:39:00 +02:00
Douwe Maan 98f982f91d Only postgres does case sensitive compares 2015-10-22 10:19:12 +02:00
Dirceu Pereira Tiegs d7bcfe4fc0 Fix issue #3055 (project search with unmatched parentheses) 2015-10-21 10:20:40 -02:00
Douwe Maan 310f49af35 Don't load entire spec with MySQL 2015-10-21 10:21:01 +02:00
Douwe Maan 4a02dfa48f Disable case sensitive spec for MySQL. 2015-10-21 10:09:40 +02:00
Douwe Maan 9769a8704c Merge branch 'git-archive-improvements-2' into 'master'
Clear archive cache asynchronously



See merge request !1651
2015-10-21 07:27:01 +00:00
Dmitriy Zaporozhets 249a9476d4 Merge branch 'reference-filter-replace-text-nodes-performance' into 'master'
Speed up searching for text references a bit



See merge request !1648
2015-10-20 16:26:53 +00:00
Jacob Vosmaer e4008bc415 Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into git-archive-improvements-2 2015-10-20 17:12:23 +02:00
Jacob Vosmaer e1fff018d7 Clear archive cache asynchronously 2015-10-20 16:53:37 +02:00
Stan Hu 9bfc531ec6 Redirect to a default path if HTTP_REFERER is not set
Safari 9.0 does not yet honor the HTML5 `origin-when-cross-origin` mode,
and it's possible load balancers/proxies strip the HTTP_REFERER from
the request header. In these cases, default to some default path.

Closes #3122

Closes https://github.com/gitlabhq/gitlabhq/issues/9731
2015-10-20 07:45:48 -07:00
Douwe Maan 2f7fc7e9f7 Prefer project with exact path to differently cased one when both exist. 2015-10-20 16:16:08 +02:00