Commit Graph
4252 Commits
Author SHA1 Message Date
Sean McGivern d863d86aeb Add sha parameter to MR accept API
The `sha` parameter is optional, and when present, must match the
current HEAD SHA of the source branch. Otherwise, the API call fails
with a 409 Conflict and a message containing the current HEAD for the
source branch.

Also tidy up some doc wording.
2016-06-01 20:29:54 +01:00
Robert Speicher 3d3c9c75aa Merge branch 'style/enable-semicolon-rubocop-cop' into 'master'
Enable Style/Semicolon rubocop style cop

Don't use semicolons to terminate expressions.

See #17478.

See merge request !4351
2016-06-01 17:41:19 +00:00
Douwe Maan 2d084dd848 Merge branch 'separate-banzai-references' into 'master'
Separate reference gathering from rendering

This is a required step to allow batch processing when gathering references. This in turn would allow grabbing (for example) all mentioned users of an issue/merge request using a single query.

cc @rspeicher @DouweM 

See merge request !3969
2016-06-01 15:51:59 +00:00
Douwe Maan 4a50e1f051 Merge branch 'current-settings-use-request-store-during-request' 2016-06-01 12:55:00 +02:00
Douwe Maan c0f19cc94e Merge branch 'fix-404-labels-in-todos' into 'master'
Fix 404 page when viewing TODOs that contain milestones or labels in different projects

A user viewing the TODOs page will see a 404 if there are mentioned milestones or labels in multiple different projects. This is likely a caching bug and only occurs
when Markdown rendering occurs across multiple projects, which is why it's so tricky to reproduce. This is what I think is happening:
    
1. LabelReferenceFilter#references_in encounters label ~X for ProjectA and finds the label in the DB as id = 1.
2. LabelReferenceFilter.references_in yields [1, 'X', nil, ...]
3. Since project_ref is nil, AbstractReferenceFilter#project_from_ref_cache caches nil => ProjectA.
4. LabelReferenceFilter#references_in encounters label ~Y for ProjectB and finds the label in the DB as id = 2.
5. LabelReferenceFilter.references_in yields [2, 'Y', nil, ...]
6. AbstractReferenceFilter#project_from_ref_cache lookups nil and returns ProjectA. It was supposed to be ProjectB.
7. A is the wrong project, so the label lookup fails.
   
This MR expands the `project_ref` to the right value as soon as we have it to avoid this caching bug.
    
Closes #17898


See merge request !4312
2016-06-01 10:50:03 +00:00
Rémy Coutable 46ac3107a4 Merge branch 'issue_15557' into 'master'
Fix error 500 when sorting issues by milestone due date and filtering by labels

fixes #15557 

See merge request !4327
2016-06-01 08:42:36 +00:00
Dmitriy Zaporozhets cb261abee1 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2016-06-01 11:34:45 +03:00
Grzegorz Bizon face87b7bb Enable Style/Semicolon rubocop style cop
See #17478
2016-06-01 08:45:14 +02:00
Stan Hu f8a3344d12 Fix 404 page when viewing TODOs that contain milestones or labels in different projects
A user viewing the TODOs page will see a 404 if there are mentioned labels
in multiple different projects. This is likely a caching bug and only occurs
when Markdown rendering occurs across multiple projects, which is why it's so
tricky to reproduce. This is what I think is happening:

1. LabelReferenceFilter#references_in encounters label ~X for ProjectA and finds the label in the DB as id = 1.
2. LabelReferenceFilter.references_in yields [1, 'X', nil, ...]
3. Since project_ref is nil, AbstractReferenceFilter#project_from_ref_cache caches nil => ProjectA.
4. LabelReferenceFilter#references_in encounters label ~Y for ProjectB and finds the label in the DB as id = 2.
5. LabelReferenceFilter.references_in yields [2, 'Y', nil, ...]
6. AbstractReferenceFilter#project_from_ref_cache lookups nil and returns ProjectA. It was supposed to be ProjectB.
7. A is the wrong project, so the label lookup fails.

This MR caches Markdown references if the key is present.

Closes #17898
2016-05-31 20:37:53 -07:00
Felipe Artur 56f3b243ce Add leading comment space cop 2016-05-31 19:33:46 -03:00
Robert Speicher 613bcdc626 Merge branch 'data_leak' into 'master'
Confidential notes data leak

Fixes part of https://gitlab.com/gitlab-org/gitlab-ee/issues/575

See merge request !1967
2016-05-31 19:35:13 +00:00
Valery Sizov 9154586ce5 Confidential notes data leak 2016-05-31 21:32:53 +03:00
Robert Speicher b826c9ff17 Create the specified remote directory during backup
This is idempotent, so there's no harm calling it if the directory
already exists.

Closes #12710
2016-05-31 13:29:37 -04:00
Kamil Trzcinski 846d111f1d Add Application Setting to configure Container Registry token expire delay (default 5min) 2016-05-31 13:23:13 +02:00
Robert Speicher e7586cfbdc Merge branch 'rubocop/enable-negatedif-style-cop' into 'master'
Enable Style/NegatedIf Rubocop cop

Favor `unless` over `if` for negative conditions (or control flow ||).

```ruby
# bad
do_something if !some_condition
# bad
do_something if not some_condition

# good
do_something unless some_condition
# good
some_condition || do_something
```

See #17478

See merge request !4355
2016-05-30 17:59:10 +00:00
Robert Speicher ea32937630 Merge branch 'rubocop/enable-literal-in-condition-cop' into 'master'
Enable Lint/LiteralInCondition rubocop cop

Detects literals used in conditions.

See #17478

See merge request !4354
2016-05-30 17:56:15 +00:00
Robert Speicher a8e80d4a59 Merge branch 'style/enable-rubocop-indent-assignment-cop' into 'master'
Enable Style/IndentAssignment Rubocop style cop

Checks the indentation of the first line of the right-hand-side of a multi-line assignment.

See #17478

See merge request !4348
2016-05-30 17:41:43 +00:00
Robert Speicher 38e0e399de Merge branch 'style/enable-while-until-do-rubocop-style-cop' into 'master'
Enable Style/WhileUntilDo rubocop style cop

Checks for redundant `do` after `while` or `until`.

See #17478

See merge request !4350
2016-05-30 17:36:30 +00:00
Robert Speicher 6eaf327a57 Merge branch 'rubocop/enable-redundant-parentheses-cop' into 'master'
Enable Style/RedundantParentheses rubocop cop

Checks for parentheses that seem not to serve any purpose.

See #17478 

See merge request !4361
2016-05-30 17:20:56 +00:00
Grzegorz Bizon c370dce01c Enable Style/RedundantParentheses rubocop cop
See #17478
2016-05-30 15:07:18 +02:00
Grzegorz Bizon 53bf080f67 Enable Style/SpaceBeforeComment rubocop cop
See #17478
2016-05-30 14:36:28 +02:00
Grzegorz Bizon a55e8f109f Enable Style/NegatedIf Rubocop cop
Favor `unless` over `if` for negative conditions
(or control flow ||).

See #17478
2016-05-30 13:53:25 +02:00
Grzegorz Bizon 86cf9dd253 Enable Lint/LiteralInCondition rubocop cop
Checks of literals used in conditions.

See #17478
2016-05-30 12:34:25 +02:00
Grzegorz Bizon 0ea017d997 Enable Style/WhileUntilDo rubocop style cop
See #17478
2016-05-30 11:37:14 +02:00
Grzegorz Bizon f0375f8226 Enable Style/IndentAssignment Rubocop style cop
See #17478
2016-05-30 10:45:10 +02:00
DJ Mountney c8eb1dccab Try and use cache for application settings even when the db is not connected 2016-05-29 12:53:30 -07:00
DJ Mountney 78d8458773 Only use RequestStore for current_application_settings during a request
This fixes an issue where the RequestStore was being populated with the settings in the unicorn master
during the rails initializers. Each forked worker would then start their first request with an uncleaned RequestStore.
2016-05-27 14:28:04 -07:00
Robert Speicher 1d2d67b9e3 Merge branch 'fix/gitlab-importer-issue' into 'master'
Fix gitlab importer issue

Fixed credentials not being called correctly - probably some bad refactoring or search & replace... 

Fixes https://gitlab.com/gitlab-org/gitlab-ee/issues/565

See merge request !4301
2016-05-26 21:36:01 +00:00
Yorick Peterse 9bdfc98242 Merge branch 'measure-proxy-timing' into 'master'
Measure proxy flight time

See merge request !4278
2016-05-26 17:05:26 +00:00
Jacob Vosmaer 5771114f9b Rename metric to 'rails queue duration' 2016-05-26 17:53:21 +02:00
Yorick Peterse 86166d2802 Split Markdown rendering & reference gathering
This splits the Markdown rendering and reference extraction phases into
two distinct code bases. The reference extraction phase no longer relies
on the html-pipeline Gem (and any related code) and allows for
extracting of references from multiple HTML nodes in a single pass. This
means that if you want to extract user references from 200 comments you
no longer need to run 200 times N number of queries, instead only a
handful of queries may be needed.
2016-05-26 17:14:00 +02:00
Yorick Peterse 94d5416db6 Added Gitlab::Lazy
This class can be used to lazy-evaluate blocks of code the first time
they're called. This can be useful when a method performs a certain
heavy operation (e.g. a SQL query) that you only want to perform
whenever the result is used for the first time.
2016-05-26 13:58:01 +02:00
James Lopez bf484ffee4 fix bad refactoring of import data credentials 2016-05-26 11:25:35 +02:00
Dmitriy Zaporozhets adc64e4583 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2016-05-26 10:30:11 +02:00
Jacob Schatz 3d009f7785 Merge branch 'updated-contrib-calendar' into 'master'
POC: Updated contrib calendar

In an effort to cut down the JS file size - i've removed the heatmap calendar used for the contributing calendar on users profiles. We already have d3 on the page so why not use it instead of using a library which uses it?

![Screen_Shot_2016-04-27_at_11.08.41](/uploads/64c40f0c766f800fd0e33ac8be7f9644/Screen_Shot_2016-04-27_at_11.08.41.png)

cc. @jschatz1 

See merge request !3944
2016-05-25 23:29:41 +00:00
Douwe Maan 99cd419132 Merge branch 'fix/import-url-uri-issue' into 'master'
Fix for import URL URI problem when URL contains a space

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17559

Prevents an already encoded URL to be encoded again - preventing %20 => %25%20

See merge request !4180
2016-05-25 20:48:30 +00:00
Douwe Maan 74fb500415 Merge branch 'issue_10725' into 'master'
Fix forks creation when visibility level is restricted

fixes #10725

See merge request !4283
2016-05-25 20:47:46 +00:00
Douwe Maan 9971782200 Merge branch 'fix-issue-17496' into 'master'
Fix groups API to list only user's accessible projects

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/17496

See merge request !1966
2016-05-25 20:28:17 +00:00
Robert Speicher 3c2d0cf24c Merge branch 'complexity/enable-multiple-rubocop-cops-2' into 'master'
Enable multiple compatible Rubocop cops

## What does this MR do?

This MR enables multiple Rubocop cops, that are already compatible with
our codebase. See #17406.

Cops enabled:

```text
Style/ArrayJoin:
  Description: Use Array#join instead of Array#*.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
----------------
Style/Attr:
  Description: Checks for uses of Module#attr.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
----------------
Style/BlockComments:
  Description: Do not use block comments.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
----------------
Style/ClassMethods:
  Description: Use self when defining module/class methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#def-self-class-methods
----------------
Style/EndBlock:
  Description: Avoid the use of END blocks.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-END-blocks
----------------
Style/EvenOdd:
  Description: Favor the use of Fixnum#even? && Fixnum#odd?
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
----------------
Style/FileName:
  Description: Use snake_case for source file names.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
  ExpectMatchingDefinition: false
----------------
Style/FirstMethodParameterLineBreak:
  Description: Checks for a line break before the first parameter in a multi-line method
    parameter definition.
----------------
Style/FlipFlop:
  Description: Checks for flip flops
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
----------------
Style/GlobalVars:
  Description: Do not introduce global variables.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
  Reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
----------------
Style/IfWithSemicolon:
  Description: Do not use if x; .... Use the ternary operator instead.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
----------------
Style/LambdaCall:
  Description: Use lambda.call(...) instead of lambda.(...).
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
  EnforcedStyle: call
----------------
Style/MethodName:
  Description: Use the configured style when naming methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
  EnforcedStyle: snake_case
----------------
Style/MultilineMethodDefinitionBraceLayout:
  Description: Checks that the closing brace in a method definition is symmetrical with
    respect to the opening brace and the method parameters.
----------------
Style/NestedModifier:
  Description: Avoid using nested modifiers.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-modifiers
----------------
Style/OpMethod:
  Description: When defining binary operators, name the argument other.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
----------------
Style/SignalException:
  Description: Checks for proper usage of fail and raise.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-raise-over-fail
  EnforcedStyle: only_raise
----------------
Style/SpaceAfterNot:
  Description: Tracks redundant space after the ! operator.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-bang
----------------
Style/SpaceBeforeSemicolon:
  Description: No spaces before semicolons.
----------------
Style/SpaceInsideRangeLiteral:
  Description: No spaces inside range literals.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals
----------------
Style/SpaceInsideStringInterpolation:
  Description: Checks for padding/surrounding spaces inside string interpolation.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#string-interpolation
  EnforcedStyle: no_space
----------------
Style/StabbyLambdaParentheses:
  Description: Check for the usage of parentheses around stabby lambda arguments.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args
  EnforcedStyle: require_parentheses
----------------
Style/StringMethods:
  Description: Checks if configured preferred methods are used over non-preferred.
  PreferredMethods:
    intern: to_sym
----------------
Style/VariableInterpolation:
  Description: Don't interpolate global, instance and class variables directly in strings.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
----------------
Style/VariableName:
  Description: Use the configured style when naming variables.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
  EnforcedStyle: snake_case
----------------
Style/WhenThen:
  Description: Use when x then ... for one-line cases.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
----------------
Style/WhileUntilModifier:
  Description: Favor modifier while/until usage when you have a single-line body.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
  MaxLineLength: 80
```

Closes #17406 

See merge request !4286
2016-05-25 19:41:10 +00:00
DJ Mountney 1a7326ba9a Switch the gitlab:db:configure task to use tables.any? instead of looking specifically for the schema_migrations table 2016-05-25 10:47:09 -07:00
DJ Mountney 24632d2150 Update hash syntax and add changelog for the gitlab:db:configure rake task 2016-05-25 10:44:22 -07:00
DJ Mountney c6e7d826b2 Add a gitlab:db:configure rake task to handle conditionally seeding or migrating the database. 2016-05-25 10:44:22 -07:00
Felipe Artur 5273335247 Fix forks creation when visibility level is restricted 2016-05-25 10:57:00 -04:00
Jacob Vosmaer c049534da6 Align class name with field name 2016-05-25 14:55:23 +02:00
Jacob Vosmaer 3c785a761c Send data to InfluxDB instead of stdout 2016-05-25 14:28:21 +02:00
Jacob Schatz 318b22459b Merge branch 'incremental-fixes' into 'master'
Fix concurrent request when updating build log in browser

If you have a slow internet connection the trace will not be updated correctly. We need to check if our request is the latest one.

Fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/17535

See merge request !4183
2016-05-25 11:51:20 +00:00
Douwe Maan 019a3c781e Merge branch 'fix-registry-backups' into 'master'
Fix backups if registry is disabled

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17749

See merge request !4263
2016-05-25 09:28:22 +00:00
Grzegorz Bizon 2c7439db4d Enable multiple compatible Rubocop cops
Closes #17406
2016-05-25 06:17:29 +02:00
Kamil Trzcinski 718fe268c4 Improve after review 2016-05-24 22:52:31 -05:00
Stan Hu b359d5d57f Fix groups API to list only user's accessible projects
Closes #17496
2016-05-24 18:14:12 -07:00