Commit Graph

2595 Commits

Author SHA1 Message Date
Robert Speicher 4e22dcb6a3 Add spec to RelativeLinkFilter for Unicode filenames 2015-07-30 17:25:07 -04:00
Robert Speicher 6d6f807b75 Merge branch 'fix-image-file-is-not-displayed' into 'master'
Update RelativeLinkFilter to support non-ASCII filenames

See merge request !1050
2015-07-30 21:24:13 +00:00
Stan Hu fcf8a6482f Merge branch 'backup-directory-permissions' into 'master'
Backup directory permissions

This sidesteps problems with running 'chmod' on some CIFS mounts.

Closes #1704 
https://gitlab.com/gitlab-org/gitlab-ce/issues/1704

See merge request !1065
2015-07-30 14:11:41 +00:00
Jacob Vosmaer c13e2290bc Merge branch 'fix-rake-check-hooks' into 'master'
Check that hooks directory exists before attempting to call realpath

This MR checks that the hooks directories actually exist before attempting to resolve their `realpath`.

Users who attempted to restore from source to an omnibus installation would get ugly errors when running `gitlab-rake gitlab:check`:

```
Errno::ENOENT: No such file or directory @ realpath_rec - /var/opt/gitlab/git-data/repositories/Wanda/www.git/hooks
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/check.rake:488:in `realpath'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/check.rake:488:in `block in check_repos_hooks_directory_is_link'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/relation/batches.rb:52:in `block (2 levels) in find_each'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/relation/batches.rb:52:in `each'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/relation/batches.rb:52:in `block in find_each'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/relation/batches.rb:126:in `find_in_batches'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/relation/batches.rb:51:in `find_each'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/querying.rb:9:in `find_each'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/check.rake:482:in `check_repos_hooks_directory_is_link'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/check.rake:343:in `block (3 levels) in <top (required)>'
Tasks: TOP => gitlab:check => gitlab:gitlab_shell:check
```

Closes #2121

#2082

See merge request !1068
2015-07-30 14:07:59 +00:00
Stan Hu ee17102848 Check that hooks directory exists before attempting to call realpath
Closes #2121
2015-07-30 06:53:23 -07:00
Douwe Maan 36bd6c8494 Show who last edited a comment if it wasn't the original author 2015-07-30 14:45:54 +02:00
Douwe Maan b8066e2cd0 No more web url 2015-07-30 11:56:15 +02:00
Jacob Vosmaer baa157926d Stricter mkdir's in 'rake gitlab:backup:create' 2015-07-30 10:17:34 +02:00
Stan Hu 3e9b612306 Check that project was actually created rather than just validated in import:repos task
Add gitlab-shell to error message to give user a clue that something may be wrong there.

Ran into this in #2082. User was told that repositories were created when they were
not due to hooks symlink being wrong.
2015-07-29 10:49:13 -07:00
Jacob Vosmaer 05b518aa4d Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into backup-archive-permissions 2015-07-29 15:44:04 +02:00
Douwe Maan 4fb6ddfe06 Add ability to manage user email addresses via the API. 2015-07-29 15:40:08 +02:00
Douwe Maan 76b3e44c39 Merge branch 'master' into api-new-attributes 2015-07-29 12:39:44 +02:00
Valery Sizov 8bda433734 Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2015-07-29 12:19:59 +03:00
Jacob Vosmaer c5aae30773 Set internal backup directory modes on create
This sidesteps problems with running 'chmod' on some CIFS mounts.
2015-07-29 11:18:55 +02:00
Stan Hu e6feb98773 Merge pull request #9341 from rumpelsepp/rouge
Switch back to rouge gem for synthax highlighting
2015-07-28 23:57:03 -07:00
Stefan Tatschner 00ff84d3c0 Add HTMLGitlab formatter
This custom formatter for rouge is needed to generate HTML output
specifically for gitlab. Since its usecase is mostly suitable for
gitlab it had been rejected upstream:
https://github.com/jneen/rouge/pull/268

Thanks a lot to @stanhu, @jneen and @tsigo for review!
2015-07-29 08:32:00 +02:00
Stefan Tatschner f736721c5b Replace Rugments with Rouge
I have mainly created the rugments fork for the purpose of improving
gitlab's highlighting. Nowadays IMO it works way better than the old
highlight.js solution. But the development is stuck on my side because
of a couple of personal reasons:

  * I have finished my studies; last months I was writing my master
    thesis. So there was a huge time problem. I am sorry for that.

  * I had to move to Munich due to getting a (paid) job. Searching a
    flat here is horrible... :)

  * Last but not least, maintaining the same code base in two seperate
    projects is a mess.

I have decided to switch back to rouge due to several reasons:

  * In the beginning I was quite motivated, but since I start
    working on my new job next week, the best solution IMO is
    switching back to upstream rouge.

  * Rouge is continously improving:
    https://github.com/jneen/rouge/blob/master/CHANGELOG.md
    http://rouge.jneen.net/

  * There should be absolutely no regressions with this change. Most
    likely this pull request will almost fix some minor bugs.

  * One less gem in gitlab is a good thing. since Gitlab is quite a
    huge bundle of gems. Reducing complexity should be a major
    milestone.

Thanks a lot to @stanhu and @jneen for the review!
2015-07-29 07:40:58 +02:00
GitLab 16dcf356b5 Fix style points
To make Rubocop and Douwe happy
2015-07-28 18:04:57 +02:00
GitLab 6912f21e5c Send GL_ID to gitlab-git-http-server as JSON 2015-07-28 15:55:53 +02:00
Douwe Maan a784b996b3 Add project star and fork count, group avatar URL and user/group web URL attributes to API 2015-07-28 15:49:44 +02:00
Douwe Maan 42ebd902de Fix bug causing Bitbucket importer to crash when OAuth application had been removed. 2015-07-28 15:33:16 +02:00
GitLab ae9e5eea3c Handle missing @user during Git HTTP requests 2015-07-28 15:17:06 +02:00
Jacob Vosmaer d3305df7aa Experimental support for gitlab-git-http-server
https://gitlab.com/gitlab-org/gitlab-git-http-server

This change introduces the GITLAB_GRACK_AUTH_ONLY environment
variable. When set, Grack requests to GitLab will only respond with
the user's GL_ID (if the request is OK) or an error. This allows
gitlab-git-http-server to use the main GitLab application as an
authentication and authorization backend.

If we like how this works we should drop the GITLAB_GRACK_AUTH_ONLY
variable at some point in the future.
2015-07-28 14:33:19 +02:00
Douwe Maan 43d1188031 Merge branch 'fix-api-mr-notes-ordering' into 'master'
Return comments in created order in merge request API

Closes #1832

See merge request !985
2015-07-28 09:15:08 +00:00
Jacob Vosmaer 0be6debb0b Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into backup-archive-permissions 2015-07-27 11:22:35 +02:00
Valery Sizov 4a8076a35f Merge branch 'rake-update-commit-count' into 'master'
Add rake task 'gitlab:update_commit_count'

Starting with migration `20150717130904` commit count is stored in the
database. For existing projects it defaults to `0` and is updated to the
correct value when commits are pushed.

The newly introduced rake task updates the commit count for all projects
which have not been updated yet.

![gitlab-rake-update-commit-count](https://gitlab.com/gitlab-org/gitlab-ce/uploads/4785009e0f3fc4c3199fe65dfb8e60e0/gitlab-rake-update-commit-count.png)

Refs !986, !989, #2040, #2089.

See merge request !1040
2015-07-27 08:06:42 +00:00
Hiroyuki Sato 1cd2860065 Fix the image file that contains non-ascii character is not displayed 2015-07-27 16:18:12 +09:00
Stan Hu 71a8c780ff Merge branch 'master' of github.com:gitlabhq/gitlabhq 2015-07-24 14:39:04 -07:00
Daniel Gerhardt d3cae9278f Add rake task 'gitlab:update_commit_count'
Starting with migration `20150717130904` commit count is stored in the
database. For existing projects it defaults to `0` and is updated to the
correct value when commits are pushed.

The newly introduced rake task updates the commit count for all projects
which have not been updated yet.

Refs !986, !989, #2040.
2015-07-24 16:20:28 +02:00
Valery Sizov 70de5114fb Merge branch 'auth-icons-labels' into 'master'
Allow custom label to be set for authentication providers.

Addresses internal issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2341

Beside the above, I've:
- Refactored `OauthHelper` to have clearer method names and behaviour
- Moved some of `OauthHelper` behaviour to `Gitlab::OAuth::Provider`
- Renamed `OauthHelper` to `AuthHelper` since LDAP, SAML, Kerberos aren't OAuth
- Updated the icons for GitHub and GitLab

In the examples below, "OurAuth" is a SAML provider with a custom label.

![Screen_Shot_2015-07-02_at_16.29.52](https://gitlab.com/gitlab-org/gitlab-ce/uploads/7d425bde69dc34e1667ebd5375d0266d/Screen_Shot_2015-07-02_at_16.29.52.png)

![Screen_Shot_2015-07-02_at_16.31.40](https://gitlab.com/gitlab-org/gitlab-ce/uploads/cbb273321ecdf4cab3d3ef0dc35553e7/Screen_Shot_2015-07-02_at_16.31.40.png)

![Screen_Shot_2015-07-02_at_16.32.39](https://gitlab.com/gitlab-org/gitlab-ce/uploads/d8dd6e1d0dc45a788e869cdcdc99e178/Screen_Shot_2015-07-02_at_16.32.39.png)

![Screen_Shot_2015-07-02_at_16.33.18](https://gitlab.com/gitlab-org/gitlab-ce/uploads/7dbfe8b0ae229c32a08d6c7442976d83/Screen_Shot_2015-07-02_at_16.33.18.png)


See merge request !927
2015-07-24 11:28:55 +00:00
Douwe Maan b7be08c515 Merge branch 'changes_for_gmail_inbox_actions' into 'master'
Changes for gmail inbox actions

Related to the ongoing efforts to get Gmail inbox actions for GitLab.com in #1517

Not using `mdash` would break the rendering of the html email by switching `Content-Transfer-Encoding` to `quoted-printable` for every email.

Removed the rake task and docs to prevent users from sending dummy emails which might cause application rejection.

See merge request !1024
2015-07-23 14:35:31 +00:00
Douwe Maan 70a3c165a9 Allow custom label to be set for authentication providers. 2015-07-23 15:20:12 +02:00
ngentile dbff6bc106 Gitlab Issue 707: Indent unfolded code 1 character 2015-07-22 09:58:17 -04:00
Douwe Maan 276ca427ea Fix Remove source-branch for MRs from same project 2015-07-22 14:07:41 +02:00
Marin Jankovski ca451365ab Remove docs and rake task for gmail actions to prevent problems with registration. 2015-07-22 11:46:08 +02:00
Jacob Vosmaer 346b074979 Don't stop if database.sql.gz already exists
The existing behavior of the backups is to overwrite whatever data
was still there in the scratch directories. This broke when we added
a 'gzip' step because 'gzip database.sql' will fail if 'database.sql.gz'
already exists. Doing 'rm -f database.sql.gz' before the 'gzip'
avoids this failure.
2015-07-21 10:37:27 +02:00
Stan Hu e8c147903b Merge branch 'gc-images-no-casing' into 'master'
GoogleCode importer: Do not care about casing of image file extensions

When a GoogleCode repository contains an attached image with an UPPERCASE file extension, it's not inlined.

/CC @DouweM

See merge request !1003
2015-07-20 16:42:52 +00:00
Jacob Vosmaer 83304bf410 Merge pull request #9400 from tuxillo/patch-1
Use whoami instead of $USER
2015-07-20 11:45:34 +02:00
Sven Strickroth 5eeab9f0a6 GoogleCode importer: Do not care about casing of image file extensions
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2015-07-20 00:53:43 +02:00
Dmitriy Zaporozhets f0116f1335
Store commit count in project table
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-17 15:22:56 +02:00
Dmitriy Zaporozhets 67ca5a53f6
Build missing cache items in background job after each push
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-17 14:50:03 +02:00
Stan Hu 6c9f527b3f Return comments in created order in merge request API
Closes #1832
2015-07-16 22:33:58 -07:00
Dmitriy Zaporozhets a7fded9b95
Huge refactoring for accepting merge requests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-16 16:03:07 +02:00
Dmitriy Zaporozhets 2be3c94925 Fix application initialize 2015-07-15 15:59:38 +02:00
Dmitriy Zaporozhets a87989fb7d Remove satellites 2015-07-15 15:45:57 +02:00
Stan Hu daed441dfe Merge branch 'merge-request-wip-information' into 'master'
api: expose work_in_progress flag

See merge request !948
2015-07-15 01:13:05 +00:00
Douwe Maan b93053695a Fix transferring of project to another group using the API. 2015-07-11 16:47:33 -04:00
Ben Boeckel 414cacd7f4 api: expose work_in_progress flag 2015-07-10 10:33:43 -04:00
Dmitriy Zaporozhets bda04bc687 Merge branch 'fork_visibility_level' into 'master'
Forks should not have more permissive visibility levels than the original

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

See merge request !936
2015-07-10 12:05:54 +00:00
Stan Hu 4c586dc7c2 Revert "api: add 'system', 'upvote', and 'downvote' fields to note queries"
This reverts commit dd4fee5fdb.
2015-07-09 12:35:53 -07:00
Ben Boeckel dd4fee5fdb api: add 'system', 'upvote', and 'downvote' fields to note queries 2015-07-09 11:24:28 -04:00
Dmitriy Zaporozhets 1bf3e1578a
Properly render plain readme
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-09 11:36:09 +02:00
Francesco Coda Zabetta 6d56bd8690 use teaspoon instead of jasmine for testing javascript 2015-07-08 17:46:51 +02:00
Dmitriy Zaporozhets b9452d7bcd Merge branch 'improve-postgres-restore-cleaning' into 'master'
Use native Postgres database cleaning during backup restore

We were using hacks to drop tables etc during a Postgres backup
restore. With this change, we let pg_dump insert the DROP TABLE
statements it needs at the start of the SQL dump.

See merge request !1891
2015-07-07 23:02:48 +00:00
Jacob Vosmaer 90ab5a59bb Use native Postgres database cleaning during backup restore
We were using hacks to drop tables etc during a Postgres backup
restore. With this change, we let pg_dump insert the DROP TABLE
statements it needs at the start of the SQL dump.
2015-07-07 15:34:06 +02:00
Kamil Trzciński 474d798c42 Merge branch 'compress-db' into 'master'
Compress database backup

Restore handles both cases: uncompressed and compressed backup. As an improvement `IO.popen` can be used.

/cc @jacobvosmaer

See merge request !873
2015-07-07 10:58:27 +00:00
Dmitriy Zaporozhets f76092c06d Merge branch 'settings-via-api' into 'master'
API to set application settings for admin

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

See merge request !934
2015-07-07 10:57:41 +00:00
Jacob Vosmaer bb50b7fcd0 Allow custom backup archive permissions
This change helps system administrators who want to replicate
GitLab backup files without needing root permissions.
2015-07-06 18:43:17 +02:00
Kamil Trzcinski 69c659ebd3 Compress database backup 2015-07-06 17:14:17 +02:00
Dmitriy Zaporozhets 603ceea21a
Add tests and improve logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-06 16:47:19 +02:00
Valery Sizov 111ebe5471 Fork visibility level fix 2015-07-06 17:40:33 +03:00
Dmitriy Zaporozhets b28714b6a9
Add docs and empty specs for applicaiton settings API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-06 15:53:08 +02:00
Dmitriy Zaporozhets b2e2444436 Merge pull request #9430 from gitlabhq/fix-rake-test-ci
Use teaspoon instead of jasmine:ci
2015-07-06 15:50:37 +02:00
Dmitriy Zaporozhets c2ee6862c8
API to set application settings for admin
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-03 16:50:21 +02:00
Steve Norman b3a751112d Allow user to be blocked and unblocked via the API 2015-07-03 11:17:57 +00:00
Dmitriy Zaporozhets 18ef9befc0
Use teaspoon instead of jasmine:ci
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-03 10:51:44 +02:00
Stan Hu 9add3e6eb5 Extract the longest-matching ref from a commit path when multiple matches occur
Closes #1839
2015-07-01 07:01:59 -07:00
Kamil Trzcinski a34c61d9c6 Reuse HTML Pipeline object in Markdown parser
The patches reduces pressure on GC and reduces markdown processing time
2015-06-30 13:59:27 +02:00
Stan Hu e3dbaa7027 Merge branch '1791-fix-github-issue-order' into 'master'
Fix wrong order of issues when importing from github

### 1. What does this MR do?

The order of issues imported from GitHub is fixed.

### 2. Are there points in the code the reviewer needs to double check?

Nothing.

### 3. Why was this MR needed?

The default behaviors of GitHub API at listing issues are sort: :created and direction: :desc.

See GitHub API details at https://developer.github.com/v3/issues/#list-issues.

### 4. What are the relevant issue numbers / Feature requests?

Fixes #1791

### 5. Screenshots (if relevant)

Nothing

See merge request !898
2015-06-29 14:15:47 +00:00
Robert Speicher 60c7d35543 Remove jasmine:ci task, execute teaspoon directly on CI 2015-06-28 16:27:40 -04:00
Hiroyuki Sato 4a203aab57 Fix wrong order of issues when importing from github
See API details at https://developer.github.com/v3/issues/.
Refs #1791
2015-06-28 04:02:21 +09:00
Dmitriy Zaporozhets 9f166a8649 Merge branch 'rename-abilities' into 'master'
Rename abilities to correspond contoller/model action names

write_ was renamed to create_
modify_  was renamed to update_

So now in update action we have next code

```
def create
  can?(current_user, :create_issue, @issue)
end

def update
  can?(current_user, :update_issue, @issue)
end
```

See merge request !896
2015-06-26 16:39:17 +00:00
Dmitriy Zaporozhets 58ceb8e950
Only people who can manage issue can assign labels to it
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 16:02:57 +02:00
Dmitriy Zaporozhets 342d553709
Rename abilities to correspond contoller/model action names
write_ was renamed to create_
modify_  was renamed to update_

So now in update action we have next code

def create
  can?(current_user, :create_issue, @issue)
end

def update
  can?(current_user, :update_issue, @issue)
end

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:55:56 +02:00
Stan Hu 6548e9b48c Add 2FA status to user admin API
Closes https://github.com/gitlabhq/gitlabhq/issues/9391
2015-06-23 22:41:59 -07:00
Dmitriy Zaporozhets b902a9b83d Merge branch 'split-tests' into 'master'
Split rspec and spinach tests in parallel

For https://dev.gitlab.org/gitlab/gitlabhq/issues/2386

See merge request !874
2015-06-23 15:17:11 +00:00
Dmitriy Zaporozhets 541f7675f9 Merge branch 'fix-diff-patch-public-mr' into 'master'
Fix downloading of patches on public merge requests when user logged out

### What does this MR do?

This MR makes it possible to download a diff patch on a public merge request when a user is logged out.

### Why was this MR needed?

An Error 500 would result when a user attempted to click on the "Email Patches" or "Plain Diff" button:

```
NoMethodError - undefined method `id' for nil:NilClass:
  lib/gitlab/backend/shell_env.rb:9:in `set_env'
  lib/gitlab/satellite/action.rb:20:in `in_locked_and_timed_satellite'
  lib/gitlab/satellite/merge_action.rb:49:in `diff_in_satellite'
  app/models/merge_request.rb:219:in `to_diff'
  app/controllers/projects/merge_requests_controller.rb:42:in `block (2 levels) in show'
```

### What are the relevant issue numbers?

* Closes #1225
* Closes #1854 (dup)
* Closes #1858 (dup)

See merge request !872
2015-06-23 15:03:00 +00:00
Dmitriy Zaporozhets b8f12d1917 Replace GITLAB with GitLab in rake task descriptions 2015-06-23 16:52:40 +02:00
Dmitriy Zaporozhets 12e0998635 Refactor rake tasks for tests 2015-06-23 16:48:52 +02:00
Dmitriy Zaporozhets 94f130cbfc Merge branch 'admin-edit-identities' into 'master'
Admin can see, edit and remove user identities

Related to #1415 and https://dev.gitlab.org/gitlab/gitlabhq/issues/2224

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

See merge request !843
2015-06-23 14:24:16 +00:00
Stan Hu 555fd0cf4a Fix downloading of patches on public merge requests when user logged out
Closes #1225
Closes #1854
Closes #1858
2015-06-23 05:34:21 -07:00
Stan Hu e80d7a804f Fix error when deleting a user who has projects
Closes #1856
Closes https://github.com/gitlabhq/gitlabhq/issues/9394
2015-06-23 04:39:49 -07:00
Dmitriy Zaporozhets 73e003013f
Merge branch 'master' into admin-edit-identities
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	app/views/admin/users/show.html.haml
2015-06-22 18:00:11 +02:00
Dmitriy Zaporozhets b21390936a
Make provider a select for identities form in admin area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-22 16:53:11 +02:00
Dmitriy Zaporozhets bcb07929fe Merge branch 'nginx_defaulthost_documentation' into 'master'
Close #178 Nginx conf default_host documentation

This closes #178
We're just making it clear that some nginx installs such as by default on recent Ubuntu's, the /etc/nginx/sites-enabled/default file will conflict the listen line of the gitlab nginx conf's due to the default_server directive.

changed installation.md to identify the issue to a user
added notes to both nginx configs for gitlab and gitlab-ssl
[ci-skip

See merge request !225
2015-06-22 13:22:58 +00:00
Dmitriy Zaporozhets 0214a21db5 Merge branch 'restore_uploads_fix' into 'master'
Avoid "cannot copy directory ... to itself" error on restore (on Docker?)

rake gitlab:backup:restore fails for me in my Docker-hosted Gitlab-CE instance; during the restore, any existing "uploads" directory is backed up by [this code](https://gitlab.com/gitlab-org/gitlab-ce/blob/833bc30/lib/backup/uploads.rb#L23) --

```ruby
    def backup_existing_uploads_dir
      timestamped_uploads_path = File.join(app_uploads_dir, '..', "uploads.#{Time.now.to_i}")
      if File.exists?(app_uploads_dir)
        FileUtils.mv(app_uploads_dir, timestamped_uploads_path)
      end
    end
```

When this executes for me, the ```FileUtils.mv``` parameters are "/home/git/gitlab/public/uploads" and "/home/git/gitlab/public/uploads/../uploads.1407019546"; an exception is raised, producing this double stacktrace:

```
ArgumentError: cannot copy directory /home/git/gitlab/public/uploads to itself /home/git/gitlab/public/uploads/../uploads.1407019546
/home/git/gitlab/lib/backup/uploads.rb:26:in `backup_existing_uploads_dir'
/home/git/gitlab/lib/backup/uploads.rb:18:in `restore'
/home/git/gitlab/lib/tasks/gitlab/backup.rake:73:in `block (4 levels) in <top (required)>'
/home/git/gitlab/lib/tasks/gitlab/backup.rake:30:in `block (3 levels) in <top (required)>'
Errno::EXDEV: Invalid cross-device link @ sys_fail2 - (/home/git/gitlab/public/uploads, /home/git/gitlab/public/uploads/../uploads.1407019546)
/home/git/gitlab/lib/backup/uploads.rb:26:in `backup_existing_uploads_dir'
/home/git/gitlab/lib/backup/uploads.rb:18:in `restore'
/home/git/gitlab/lib/tasks/gitlab/backup.rake:73:in `block (4 levels) in <top (required)>'
/home/git/gitlab/lib/tasks/gitlab/backup.rake:30:in `block (3 levels) in <top (required)>'
Tasks: TOP => gitlab:backup:uploads:restore
(See full trace by running task with --trace)
```

I'm guessing from the first message that ```mv``` walks the destination path to ensure that we're not moving the source into itself -- it doesn't get as far as interpreting the '..', but throws when it sees that the destination appears to start with the source path.

The second stacktrace I have no clue about - maybe it's AUFS- or Docker-related?

I attempted to reproduce this separately with the omnibus distribution in a fresh Ubuntu 14.04 install without Docker involved, and was unable to - backup and restore worked fine. I then tested my theory by FileUtils.expand_path-ing the destination in my own Docker setup code, and that made the problem go away, so that's what this merge request does.

(I'm using backups created and restored on gitlab-ce 7-1-stable, at facfec4b2; this is on Ubuntu 14.04 with Docker 1.1.1)

I know I'd look askance at a PR without tests for an unreproducable problem, but even if this is rejected, I'm submitting it anyway because maybe someone else will Google it and find it useful. I'm happy to do more work to improve this if you have suggestions.

See merge request !165
2015-06-22 09:52:42 +00:00
Antonio Huete Jimenez e9ef274bb2 Use whoami instead of $USER
- Use whoami instead of relying on the existence of $USER enviroment variable which is not always present
2015-06-19 09:01:35 +02:00
Alex Lossent d96d9aae42 Fix behavior of ldap_person method in Gitlab::OAuth::User
Code tweaks in 45e9150a caused the ldap_person method to not return expected results.
Improved tests to cover the ldap_person method, which was previously stubbed.
2015-06-17 18:06:27 +02:00
Dmitriy Zaporozhets fe51fa26a7
Dont set checkout sha for removed branch/tag
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-15 17:54:22 +02:00
Dmitriy Zaporozhets 9522a710e5 Merge branch 'update_ssl_ciphers' into 'master'
Update ssl ciphers

Removing all DHE suites from Nginx template SSL ciphers.

This will deny forward secrecy for Android 2.3.7, Java 6 and OpenSSL 0.9.8. but will give A+ rating on SSL labs.

Google sites also do not have DHE suites, [source](https://community.qualys.com/blogs/securitylabs/2013/06/25/ssl-labs-deploying-forward-secrecy)

> Google's sites, for example, tend to not have any DHE suites in their configuration. [2013]

See merge request !814
2015-06-15 11:50:21 +00:00
Marin Jankovski 86d35ed3d4 Update SSL ciphers per logjam vulnerability recommendations. 2015-06-15 11:40:00 +02:00
Robert Speicher 844d72716e Add Gitlab::Themes module; remove Gitlab::Theme
Now we can simply loop through all themes, among other things.

This also removes the `dark_theme` / `light_theme` classes and the
`theme_type` helper, since they weren't used anywhere.
2015-06-13 17:58:16 -04:00
Douwe Maan 9ea8dcb5e2 Merge branch 'feature-session-expire-seconds-ui' into 'master'
Add session expiration delay configuration through UI application

Setting is accessible by the administrator through the UI and defaults to 1 week (the current setting)

Answers the following suggestions:

  * http://feedback.gitlab.com/forums/176466-general/suggestions/6210719-make-session-length-configurable
  * http://feedback.gitlab.com/forums/176466-general/suggestions/6730512-automatic-logout-after-a-time-being-idle

See merge request !774
2015-06-12 13:50:40 +00:00
Dmitriy Zaporozhets b07cf1182f Merge branch 'note_about_omnibus_changes' into 'master'
Add a note that changing example configuration files requires changing omnibus-gitlab.

Keeping track of changes in these files is not easy and they usually require change in omnibus-gitlab.

Added a note so everyone is aware of this.

Similar is added to gitlab-shell and gitlab-ci.

Discussed in gitlab-org/omnibus-gitlab#605

See merge request !800
2015-06-12 09:02:48 +00:00
Dmitriy Zaporozhets c69ca9912e Merge pull request #9371 from zenati/patch-2
An `in_namespace` scope is already present
2015-06-11 23:09:41 +02:00
Marin Jankovski df346e9507 Add a note that changing example configuration files requires changing omnibus-gitlab. 2015-06-11 15:11:37 +02:00
themaze75 1d080f5745 session_expire_seconds => session_expire_delay
delay is in seconds
more legible code in session_store
Added `GitLab restart required` help block to session_expire_delay
2015-06-10 22:10:00 -04:00
Dmitriy Zaporozhets e407a481f2 Merge branch 'rs-pre-rspec-3' into 'master'
Changes back-ported from rspec3 branch

This is just breaking up the large `road-to-rspec-3` branch a bit. Each of these commits have been cherry-picked and would be good to have in place before the upgrade.

See merge request !792
2015-06-10 14:04:12 +00:00
Dmitriy Zaporozhets 8eadfd2df7 Merge branch 'master' into 'master'
update fog to 1.25.0 and add multipart upload support

This merge will fix backup uploading problems to s3, closing gitlab-org/gitlab-ce#1059

See merge request !789
2015-06-10 12:30:44 +00:00
Robert Speicher 2f3ab0ab85 Define GITORIOUS_HOST only once 2015-06-10 01:31:27 -04:00