Commit 08b5bec2 authored by tiagonbotelho's avatar tiagonbotelho

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce

parents 8c4b6397 9ccfac27
......@@ -4,6 +4,7 @@ v 8.11.0 (unreleased)
- Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
- Limit git rev-list output count to one in forced push check
- Retrieve rendered HTML from cache in one request
- Load project invited groups and members eagerly in ProjectTeam#fetch_members
v 8.10.0
- Fix profile activity heatmap to show correct day name (eanplatter)
......
......@@ -112,7 +112,8 @@ module SearchHelper
search: params[:search],
project_id: params[:project_id],
group_id: params[:group_id],
scope: params[:scope]
scope: params[:scope],
repository_ref: params[:repository_ref]
}
options = exist_opts.merge(options)
......
......@@ -173,7 +173,7 @@ class ProjectTeam
invited_members = []
if project.invited_groups.any? && project.allowed_to_share_with_group?
project.project_group_links.each do |group_link|
project.project_group_links.includes(group: [:group_members]).each do |group_link|
invited_group = group_link.group
im = invited_group.members
......
......@@ -211,11 +211,20 @@ class Repository
return if kept_around?(sha)
rugged.references.create(keep_around_ref_name(sha), sha)
# This will still fail if the file is corrupted (e.g. 0 bytes)
begin
rugged.references.create(keep_around_ref_name(sha), sha, force: true)
rescue Rugged::ReferenceError => ex
Rails.logger.error "Unable to create keep-around reference for repository #{path}: #{ex}"
end
end
def kept_around?(sha)
ref_exists?(keep_around_ref_name(sha))
begin
ref_exists?(keep_around_ref_name(sha))
rescue Rugged::ReferenceError
false
end
end
def tag_names
......
......@@ -15,13 +15,33 @@ storage load between several mount points.
## Configure GitLab
>**Warning:**
- In order for backups to work correctly the storage path must **not** be a
mount point and the GitLab user should have correct permissions for the parent
directory of the path.
In order for [backups] to work correctly, the storage path must **not** be a
mount point and the GitLab user should have correct permissions for the parent
directory of the path. In Omnibus GitLab this is taken care of automatically,
but for source installations you should be extra careful.
>
The thing is that for compatibility reasons `gitlab.yml` has a different
structure than Omnibus. In `gitlab.yml` you indicate the path for the
repositories, for example `/home/git/repositories`, while in Omnibus you
indicate `git_data_dirs`, which for the example above would be `/home/git`.
Then, Omnibus will create a `repositories` directory under that path to use with
`gitlab.yml`.
>
This little detail matters because while restoring a backup, the current
contents of `/home/git/repositories` [are moved to][raketask] `/home/git/repositories.old`,
so if `/home/git/repositories` is the mount point, then `mv` would be moving
things between mount points, and bad things could happen. Ideally,
`/home/git` would be the mount point, so then things would be moving within the
same mount point. This is guaranteed with Omnibus installations (because they
don't specify the full repository path but the parent path), but not for source
installations.
---
Edit the configuration files and add the full paths of the alternative repository
storage paths. In the example below we added two more mountpoints that we named
`nfs` and `cephfs` respectively.
Now that you've read that big fat warning above, let's edit the configuration
files and add the full paths of the alternative repository storage paths. In
the example below, we add two more mountpoints that are named `nfs` and `cephfs`
respectively.
**For installations from source**
......@@ -39,17 +59,12 @@ storage paths. In the example below we added two more mountpoints that we named
1. [Restart GitLab] for the changes to take effect.
The `gitlab_shell: repos_path` entry in `gitlab.yml` will be deprecated and
replaced by `repositories: storages` in the future, so if you are upgrading
from a version prior to 8.10, make sure to add the configuration as described
in the step above. After you make the changes and confirm they are working,
you can remove:
```yaml
repos_path: /home/git/repositories
```
which is located under the `gitlab_shell` section.
>**Note:**
The [`gitlab_shell: repos_path` entry][repospath] in `gitlab.yml` will be
deprecated and replaced by `repositories: storages` in the future, so if you
are upgrading from a version prior to 8.10, make sure to add the configuration
as described in the step above. After you make the changes and confirm they are
working, you can remove the `repos_path` line.
---
......@@ -79,3 +94,6 @@ be stored via the **Application Settings** in the Admin area.
[ce-4578]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4578
[restart gitlab]: restart_gitlab.md#installations-from-source
[reconfigure gitlab]: restart_gitlab.md#omnibus-gitlab-reconfigure
[backups]: ../raketasks/backup_restore.md
[raketask]: https://gitlab.com/gitlab-org/gitlab-ce/blob/033e5423a2594e08a7ebcd2379bd2331f4c39032/lib/backup/repository.rb#L54-56
[repospath]: https://gitlab.com/gitlab-org/gitlab-ce/blob/8-9-stable/config/gitlab.yml.example#L457
......@@ -1164,10 +1164,30 @@ describe Repository, models: true do
end
describe "#keep_around" do
it "does not fail if we attempt to reference bad commit" do
expect(repository.kept_around?('abc1234')).to be_falsey
end
it "stores a reference to the specified commit sha so it isn't garbage collected" do
repository.keep_around(sample_commit.id)
expect(repository.kept_around?(sample_commit.id)).to be_truthy
end
it "attempting to call keep_around on truncated ref does not fail" do
repository.keep_around(sample_commit.id)
ref = repository.send(:keep_around_ref_name, sample_commit.id)
path = File.join(repository.path, ref)
# Corrupt the reference
File.truncate(path, 0)
expect(repository.kept_around?(sample_commit.id)).to be_falsey
repository.keep_around(sample_commit.id)
expect(repository.kept_around?(sample_commit.id)).to be_falsey
File.delete(path)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment