Commit Graph

67 Commits

Author SHA1 Message Date
7e8b0612f3 Add latest changes from gitlab-org/gitlab@17-2-stable-ee 2024-07-16 13:12:50 +00:00
a7b3560714 Add latest changes from gitlab-org/gitlab@14-8-stable-ee 2022-02-18 09:45:46 +00:00
b76ae63846 Add latest changes from gitlab-org/gitlab@14-2-stable-ee 2021-08-19 09:08:42 +00:00
e8d2c25793 Add latest changes from gitlab-org/gitlab@14-1-stable-ee 2021-07-20 09:55:51 +00:00
8c7f4e9d5f Add latest changes from gitlab-org/gitlab@13-1-stable-ee 2020-06-18 11:18:50 +00:00
e675fe4621 Validate refs used in controllers don't have spaces
This avoids an unnecessary call to Gitaly and reduces gRPC errors.

* Closes https://gitlab.com/gitlab-org/gitaly/issues/1425
* Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58572
2019-04-14 15:26:25 -07:00
df8f0ab521 Remove options assignment from ExtractsPath
This assignment is only used by the Projects::NetworkController, so
we're needlessly assigning this very generically-named instance variable
on every controller which includes `ExtractsPath`, which is quite a few.

Further, the way we were passing this hash to
`HashWithIndifferentAccess` caused the following deprecation warning
after upgrading to Rails 5:

    DEPRECATION WARNING: #to_hash unexpectedly ignores parameter
    filtering, and will change to enforce it in Rails 5.1. Enable
    `raise_on_unfiltered_parameters` to respect parameter filtering,
    which is the default in new applications. For the existing
    deprecated behaviour, call #to_unsafe_h instead. (called from new at
    lib/extracts_path.rb:116)
2018-11-27 12:07:02 -06:00
733ae94921 Fix typos in comments and specs 2018-11-01 08:59:20 +02:00
d598e4fd93 Enable more frozen string in lib/**/*.rb
Enables frozen for the following:

* lib/*.rb
* lib/banzai/**/*.rb
* lib/bitbucket/**/*.rb
* lib/constraints/**/*.rb
* lib/container_registry/**/*.rb
* lib/declarative_policy/**/*.rb

Partially addresses #47424.
2018-10-06 17:02:50 -07:00
def3ab2971 Fix rubocop Style/ZeroLengthPredicate 2018-09-18 14:31:17 +05:00
31f2608161 Fix handling of annotated tags when Gitaly is not in use
Attempting to view an annotated tag in the TreeController would result
in `NoMethodError: undefined method 'tree'` when Rugged was in use.
`Blob#find_by_rugged` assumes that the ref is a true. Using
the commit ID ensures that the right ref is being used.

Note that in 11.1, `Blob#find` no longer uses Rugged, so this is only
a bug in 11.0.

Closes gitlab-org/gitlab-ce#47797
2018-07-09 06:30:19 -07:00
2b6307f6ad Enable RuboCop Style/RegexpLiteral 2018-02-01 02:06:07 +09:00
02994fbe77 Backport changes from EE 2017-12-15 19:37:57 +08:00
59ac184fcf Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (671 commits)
  Make rubocop happy
  Use guard clause
  Improve language
  Prettify
  Use temp branch
  Pass info about who started the job and which job triggered it
  Docs: add indexes for monitoring and performance monitoring
  clearer-documentation-on-inline-diffs
  Add docs for commit diff discussion in merge requests
  sorting for tags api
  Clear BatchLoader after each spec to prevent holding onto records longer than necessary
  Include project in BatchLoader key to prevent returning blobs for the wrong project
  moved lfs_blob_ids method into ExtractsPath module
  Converted JS modules into exported modules
  spec fixes
  Bump gitlab-shell version to 5.10.3
  Clear caches before updating MR diffs
  Use new Ruby version 2.4 in GitLab QA images
  moved lfs blob fetch from extractspath file
  Update GitLab QA dependencies
  ...
2017-12-15 17:14:26 +08:00
cbd3ce8f41 moved lfs_blob_ids method into ExtractsPath module 2017-12-14 11:59:01 +00:00
7d2affeff1 moved lfs blob fetch from extractspath file 2017-12-14 10:10:20 +00:00
dec420feb3 fixed project homepage not having correct variable 2017-12-11 16:22:22 +00:00
07d3d44775 Move ModuleWithInstanceVariables to Gitlab namespace
And use .rubocop.yml to exclude paths we don't care,
rather than using the cop itself to exclude.
2017-11-22 17:06:57 +08:00
9ac0c76b78 Use StrongMemoize and enable/disable cops properly 2017-11-18 01:01:53 +08:00
6a4ee9aa71 Allow simple ivar ||= form. Update accordingly 2017-09-19 01:29:32 +08:00
9ae92b8caa Add cop to make sure we don't use ivar in a module 2017-09-18 21:23:45 +08:00
fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
811e598f60 Enable and autocorrect the CustomErrorClass cop 2017-03-01 15:28:10 +00:00
f88ff0cc0c Stylistic tweaks 2017-02-23 09:33:20 -06:00
ccbebbdfeb Enable Performance/RedundantMatch 2017-02-23 09:31:57 -06:00
d8cc8d7adc Remove 'extended_sha1' option from ExtractsPath module 2016-11-06 12:33:39 +09:00
56264f35d4 Network page appear with an error message when entering nonexistent git revision 2016-11-06 12:05:13 +09:00
d60d5fe4e4 Improve ExtractsPath logic related to atom format
* Don't set request format to atom if '.atom' suffix was not provided
* Don't try '.atom' detection logic on request that uses extended_sha1

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-15 01:36:05 +03:00
1022456bb1 Allow browsing branches that end with '.atom'
We need to do two things to support this:

1. Simplify the regex capture in the routing for the CommitsController
   to not exclude the '.atom' suffix. That's a perfectly valid git
   branch name, so we shouldn't blow up if we get it.
2. Because Rails now can't automatically detect the request format, add
   some code to do so in `ExtractPath` when there is no path. This means
   that, given branches 'foo' and 'foo.atom', the Atom feed for the
   former is unroutable. To fix this: don't do that! Give the branches
   different names!
2016-10-11 13:31:12 +01:00
ddbdf4e609 Restore get_id in ExtractsPath 2016-08-24 12:54:16 +02:00
bb48a0faea Do not escape URI when extracting path (!5878) 2016-08-19 18:08:08 +02:00
68cea38e94 Fix front-end for branches that happen to contain urlencoding escape characters (e.g. %)
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-11 13:21:59 +02:00
8346dde052 Only render 404 page from /public 2015-10-13 20:12:34 +03:00
ecbe119af1 Fix "Network" and "Graphs" pages for branches with encoded slashes
Closes #1359
2015-08-02 00:07:23 -07:00
9add3e6eb5 Extract the longest-matching ref from a commit path when multiple matches occur
Closes #1839
2015-07-01 07:01:59 -07:00
76aad9b76e Upgrade to Rails 4.1.9
Make the following changes to deal with new behavior in Rails 4.1.2:

* Use nested resources to avoid slashes in arguments to path helpers.
2015-02-14 11:09:23 -07:00
c916124178 Explicitly set before_filter for ref-related controllers 2015-01-26 15:01:51 -08:00
97a4d8aea4 Improve code according to new gitlab_git
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-04 14:46:15 +02:00
1d3f03fb69 Fix blob and repo stuff after gitlab_git v3 2013-10-01 18:26:55 +03:00
ae9dd62762 Update code to work with gitlab_git 3 2013-10-01 17:00:28 +03:00
1101ceb3f4 A little improvement
1. Replace params key 'q' with 'extended_sha1'. A extended SHA1 syntax is explained in 'man gitrevisions'.
2. Change the placeholder of looking for commit.
3. Change the label of ref filter.
2013-08-21 19:20:29 +09:00
5f24bdb7d0 Render not found when failing to look for a commit 2013-08-21 17:53:51 +09:00
b92655663c Update main calls to gitlab_git 2013-08-05 16:51:04 +03:00
c0e3b39792 Set @options in assing_ref_vars
@options enable to keep params when switching ref.
2013-05-13 18:44:33 +09:00
97a9c2293a Refactor: remove dup code 2013-05-13 18:41:04 +09:00
05c2c15cd1 Fix Gitlab::Git::Repository#commit returns wrong commit, if commit_id is "tag name". 2013-04-25 20:54:00 +00:00
03f41e2820 Gitlab::Git::Tree & Blob added 2013-04-02 22:37:20 +03:00
5f4445c3d3 store commits for MR as array of hashes 2013-04-02 21:30:36 +03:00
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
bbfbff3add Extend models functionality with old decorator methods. Use Repository model 2013-03-31 23:48:12 +03:00