Commit Graph
2838 Commits
Author SHA1 Message Date
Yorick Peterse 54aa0969d4 Fixed Repository#exists? to handle errors
Now that Repository#raw_repository no longer sets the autocrlf option it
will also no longer raise any NoRepository errors since it doesn't
access Rugged any more. This also means that Repository#exists? can't
simply return the raw repository as this is no indication of whether or
not the repository actually exists (besides returning a non boolean is
weird in the first place).

To solve this problem Repository#exists? now properly checks if the
repository exists and returns true/false instead of a
Gitlab::Git::Repository or nil object.
2016-02-18 12:19:49 +01:00
Yorick Peterse c475b17111 Only set autocrlf when creating/updating files
Setting the "autocrlf" Git option is an overkill since it's rarely
actually needed. More importantly, it has quite the impact on
performance (see gitlab-org/gitlab-ce#13457 for more information).

By setting "autocrlf" when creating or updating files we guarantee the
option is always set properly when we actually need it _without_
introducing overhead for requests that have nothing to do with this
option.

Fixes gitlab-org/gitlab-ce#13457
2016-02-18 11:46:05 +01:00
Rubén Dávila 2770de9617 Reopened MRs should also be considered as open. 2016-02-17 21:15:13 -05:00
Douwe Maan ff28ac9c18 Merge branch 'see-and-sort-on-vote-count-mr-issues' into 'master'
Add ability to see and sort on vote count from Issues and MR lists

Fixes #3763

* Sort options

![Sort Options](/uploads/df6543d574d4df8bf7e4496a876e2930/sort.png)

* Most popular

![Most popular](/uploads/bb92cc2fbef7b6b806dcdf8c52778fdd/most-popular.png)

* Least popular

![Least popular](/uploads/7988ed451922c81dc228419b5edbd7cd/least-popular.png)

See merge request !2781
2016-02-17 17:20:35 +00:00
Douwe Maan 6483a4c7b1 Merge branch 'fix/13367-redirect-to-project-page-if-no-import' into 'master'
Redirect /import to project page if no importing at all and repo exists


Fixes gitlab-org/gitlab-ce#13367.

See merge request !2857
2016-02-17 15:52:35 +00:00
Douwe Maan f7ee31a2c3 Merge branch 'expire-fork-import-caches' into 'master'
Expire caches after forking/importing a repository

cc @dblessing @DouweM 

Related issue: gitlab-org/gitlab-ce#13505

See merge request !2838
2016-02-17 14:07:54 +00:00
Rémy Coutable 3d3ac87af9 Redirect /import to project page if no importing at all and repo exists
Fixes #13367.
2016-02-17 15:05:44 +01:00
Douwe Maan 522eb17923 Merge branch 'klowner/gitlab-ce-fix-compare-by-tag-crash' into 'master'
Fix 500 error when comparing by tags

_Originally opened at !2787 by @klowner._

- - -

Fixes #13171.
Fixes #13370.

See merge request !2849
2016-02-17 14:00:58 +00:00
Douglas Barbosa Alexandre 9823d00e0b Add ability to see and sort on vote count from Issues and MR lists 2016-02-17 11:32:02 -02:00
Mark RiedeselandRémy Coutable e9e01bcd96 Fix 500 error when comparing by tags 2016-02-17 12:56:53 +01:00
Yorick Peterse b1203108b0 Flush all repository caches when deleting a repo
This ensures that _all_ caches (including any caches normally only
flushed under certain conditions) are flushed whenever a project is
removed. Because cache keys are based on project namespaces (excluding
IDs) not doing so could result in a newly created project re-using old
caches (if the project was re-created using the same name).
2016-02-17 11:38:18 +01:00
Yorick Peterse a9e0301c23 Expire caches after forking/importing a repository
This ensures the caches for Repository#empty? and
Repository#has_visible_content? are flushed after a repository has been
imported or forked.

Fixes gitlab-org/gitlab-ce#13505
2016-02-17 11:38:18 +01:00
Douwe Maan bbbfdba0b9 Merge branch 'bugagazavr/gitlab-ce-extend-hooks' into 'master'
Add new data to project in push, issue, merge-request and note webhooks data

_Originally opened at !2738 by @bugagazavr._

- - -

**What does this MR do?**

Adds more data to hooks, makes repository data in all hook more dry ( use one hook_attrs method for repository data in all hooks )

**Are there points in the code the reviewer needs to double check?**

1. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/project.rb#L738
2. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/concerns/issuable.rb#L132
3. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/push_data_builder.rb#L52
4. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/note_data_builder.rb#L56

**Why was this MR needed?**

More information about user for push events, and more data about repositiry ( project )

**What are the relevant issue numbers?**

No

**Screenshots (if relevant)**

No

See merge request !2788
2016-02-16 13:08:36 +00:00
Rémy Coutable 1de9513790 Use project.web_url instead deprecated repository.homepage in PushoverService 2016-02-16 13:03:00 +01:00
Yorick Peterse f253f72529 Cleaned up Repository#initialize
The "default_branch" argument is never used and the "project" argument
isn't optional.
2016-02-16 12:13:13 +01:00
Douwe Maan c142bde51d Merge branch 'fix_500-commit-null' into 'master'
Don't try to mark broken MR as mergable

In case merge request is broken, we shouldn't check if the sha
is mergable, as it will be null, and there's no point, as we know
that it's not mergable.

See merge request !2783
2016-02-12 17:40:40 +00:00
Douwe Maan 2afd95a025 Merge branch 'streamline-email-validation' into 'master'
Validate email addresses using Devise.email_regexp

Also:
- Get rid of legacy `:strict_mode`
- Get rid of custom `:email` validator
- Add some shared examples to spec emails validation

This supersedes !2754 and fixes #3851.

See merge request !2771
2016-02-12 09:09:23 +00:00
Kirill ZaitsevandRémy Coutable b123171d3d Add new data to project in push, issue, merge-request and note webhooks data
- Add `avatar_url`, `description`, `git_ssh_url`, `git_http_url`,
  `path_with_namespace` and `default_branch` in `project` in push, issue,
  merge-request and note webhooks data
- Deprecate the `ssh_url` in favor of `git_ssh_url` and `http_url` in
  favor of `git_http_url` in `project` for push, issue, merge-request and
  note webhooks data
- Deprecate the `repository` key in push, issue, merge-request and
  note webhooks data, use `project` instead
2016-02-11 17:22:11 +01:00
Nemanja Boric 8172d5ca54 Don't try to mark broken MR as mergable
In case merge request is broken, we shouldn't check if the sha
is mergable, as it will be null, and there's no point, as we know
that it's not mergable.
2016-02-11 00:38:07 +01:00
Douglas Barbosa Alexandre 9bcc9ec14c Merge branch 'display-mr-link-if-thre-is-one' into 'master'
Replaces "Create merge request" link with one to the MR when one exists

Fixes #3716

* Without MR:

![before-1](/uploads/abcb2eb5bb5927a83c2f1700528f852c/before-1.png)

* With MR:

![after-1](/uploads/9020b871e1aa08d3e5a45359336ef0f2/after-1.png)

* Without MR:

![before-2](/uploads/bb3bd1a74efc193ad31af68f1e04ef5f/before-2.png)

* With MR:

![after-2](/uploads/789d32aef12f39c605e665d0c4bc9fbe/after-2.png)

* Without MR:

![before-3](/uploads/a9aff7a11eb1069be24c37a5455be809/before-3.png)

* With MR:

![after-3](/uploads/48fe81ea50657fe5b2de0d25260d8e4b/after-3.png)

See merge request !2670
2016-02-10 21:53:41 +00:00
Robert Speicher 42607a7f17 Merge branch 'brammeleman/3047-add-assignee-data-to-isuable-hook-data' into 'master'
Add assignee data to Issuables' hook_data

Originally opened at !1633 by @brammeleman.

Fixes #3047. Fixes #2475.

See merge request !2724
2016-02-10 21:26:01 +00:00
Robert Speicher 51998fddca Merge branch 'cwq1913/gitlab-ce-fix_skip_merge_commits' into 'master'
Actually use the `skip_merges` option in Repository#commits

Originally opened at !2067 by @cwq1913.

See merge request !2750
2016-02-10 19:01:44 +00:00
Douglas Barbosa Alexandre 1353cff5fe Replaces "Create merge request" link with one to the MR when one exists 2016-02-10 10:32:25 -02:00
Bram DaamsandRémy Coutable d146d9fd83 Add assignee data to Issuables' hook_data 2016-02-10 09:40:00 +01:00
Douwe Maan 883bbd61ca Merge branch 'smarter-diverging-commit-cache-flushing' into 'master'
Smarter flushing of branch statistics caches

This basically ensures we only flush caches of branches whenever we really have to. See commit c514f8b850219cd3e5526e73e1d00e6729e2b466 for the details.

cc @joshfng @rspeicher 

See merge request !2769
2016-02-09 17:19:12 +00:00
Rémy Coutable b3635ee46a Re-add EmailValidator to avoid the repetition of format: { with: Devise.email_regexp } 2016-02-09 18:15:35 +01:00
Rémy Coutable b34963bc12 Validate email addresses using Devise.email_regexp
Also:
- Get rid of legacy :strict_mode
- Get rid of custom :email validator
- Add some shared examples to spec emails validation
2016-02-09 18:15:35 +01:00
Robert Speicher 7ea60fbfc8 Merge remote-tracking branch 'dev/master' into 'master' 2016-02-09 12:13:58 -05:00
Yorick Peterse 2ce0d06389 Smarter flushing of branch statistics caches
Instead of flushing the behind/ahead counts for all branches upon every
push we now only flush the cache of branches that actually need to have
these statistics recalculated. There are now basically 2 scenarios and
their effects:

1. A user pushes a commit to the default branch, this results in the
   cache being flushed for all branches.
2. A user pushes to a non default branch, this results in _only_ the
   cache for that branch being flushed.

The existing code (Repository#expire_cache) remains backwards compatible
with the previous behaviour, the new behaviour is only applied when a
branch name is passed as an argument. This ensures that when for example
a project is deleted the cache for all branches is flushed.
2016-02-09 17:17:56 +01:00
Douwe Maan f86ff1b833 Merge branch 'fix/max-attachment-size-setting-validation' 2016-02-09 16:52:20 +01:00
Douwe Maan 706b101f51 Merge branch 'huacnlee/gitlab-ce-feature/option-to-include-author-info-in-mail' into 'master'
Add option to include the sender name in body of Notify email

_Originally opened at !2495 by @huacnlee._

- - -

Fixes #7824.

See merge request !2767
2016-02-09 14:12:56 +00:00
Douwe Maan 643c61867c Merge branch 'zj/gitlab-ce-unique-milestone-title-per-project' 2016-02-09 13:15:37 +01:00
Jason LeeandRémy Coutable 9474e36f46 Add option to include the sender name in body of Notify email. fix #7824 2016-02-09 12:58:13 +01:00
Grzegorz Bizon 1cbc75b53c Validate maximum attachment size in application settings
`max_attachment_size` in `ApplicationSetting` should be present,
only integers greater than zero are valid.

Closes #13188
2016-02-09 12:11:16 +01:00
Robert Speicher 201fb4c7e3 Merge branch 'ci-permissions' into 'master'
Limit guest access to builds

Closes https://dev.gitlab.org/gitlab/gitlabhq/issues/2646

See merge request !1942
2016-02-08 23:33:44 +00:00
Yorick Peterse 9a99d8e49d Cache various Repository Git operations
This caches the output of the following methods:

* Repository#empty?
* Repository#has_visible_content?
* Repository#root_ref

The cache for Repository#has_visible_content? is flushed whenever a
commit is pushed to a new branch or an existing branch is removed.
The cache for Repository#root_ref is only flushed whenever a user
changes the default branch of a project. The cache for Repository#empty?
is never explicitly flushed as there's no need for it.
2016-02-08 15:40:19 +01:00
Zeger-Jan van de Weg 308c967d0d Validate uniqueness of milestone title per project
Fixes #3903
2016-02-08 12:45:32 +01:00
Tony ChuandRémy Coutable b62cdc3c47 Actually use the skip_merges option in Repository#commits 2016-02-08 12:15:42 +01:00
Robert Speicher 70b7eacfb2 Merge branch 'improve-diverging-commit-counts' into 'master'
Dedicated method for counting commits between refs

Corresponding gitlab_git merge request: https://gitlab.com/gitlab-org/gitlab_git/merge_requests/66
Issue that lead to these changes: https://gitlab.com/gitlab-org/gitlab-ce/issues/12619

See merge request !2707
2016-02-05 21:45:48 +00:00
Kamil Trzcinski 170ca8435a Merge branch 'master' into ci-permissions
# Conflicts:
#	db/schema.rb
2016-02-05 20:15:32 +01:00
Yorick Peterse b263ab618c Dedicated method for counting commits between refs
gitlab_git 8.1 adds the ability to count the amount of commits between
two references without having to allocate anything but regular
Rugged::Commit objects. This in turn speeds up the process of counting
the number of commits a branch is ahead/behind by about 3.5x.
2016-02-04 19:42:40 +01:00
Josh Frye 2ad094132d Various filter fixes 2016-02-04 13:03:41 -05:00
Kamil Trzcinski a7c441aa17 Use delete instead of assignment operator when filtering build abilities 2016-02-04 16:32:41 +01:00
Kamil Trzcinski c64c106091 Update ability model after comments 2016-02-04 14:43:52 +01:00
Kamil Trzcinski 6fea7c386f Merge remote-tracking branch 'origin/master' into ci-permissions
# Conflicts:
#	app/views/projects/builds/index.html.haml
2016-02-04 13:16:48 +01:00
Kamil Trzcinski b4c36130cc Rename allow_guest_to_access_builds to public_builds 2016-02-04 12:57:46 +01:00
Douwe Maan b5befc734b Merge branch 'disable-remove-source-branch' into 'master'
Hide remove source branch button when new commit is added to branch

Fixes #3339

This MR hides the 'Remove source branch' button when a new commit is added to the source branch

/cc @DouweM

See merge request !2701
2016-02-04 11:56:58 +00:00
Zeger-Jan van de Weg c6e0228ca9 Hide remove source branch button when new commit is added to branch
Fixes #3339

This MR hides the 'Remove source branch' button when a new commit is added to the source branch
2016-02-04 11:56:23 +01:00
Kamil Trzcinski 5f7be11aa6 Simplify abilities 2016-02-04 11:09:42 +01:00
Douwe Maan a1fa973123 Merge branch 'wipMergeSpacing' into 'master'
No space required after WIP identifier

Fixes #2426 

Currently, the WIP: (or any other variation) prefix of a merge request title must include a trailing space for it to be recognized as a work in progress and prevent merging. 
To resolve this, I added an or pattern to the regexp to look for any one of the three possible delimiters ':', ']', or ' '. This way the trailing space isn't required but it still won't mark any titles beginning with wip as work in progress (e.g. "Wipwap").

See merge request !1876
2016-02-04 09:49:54 +00:00