Commit 7248ad97 authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-05-18

# Conflicts:
#	lib/gitlab/auth/ldap/access.rb

[ci skip]
parents e234c4ea fa04ec11
...@@ -5,7 +5,7 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue'; ...@@ -5,7 +5,7 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue';
import CommitMessageField from './message_field.vue'; import CommitMessageField from './message_field.vue';
import Actions from './actions.vue'; import Actions from './actions.vue';
import SuccessMessage from './success_message.vue'; import SuccessMessage from './success_message.vue';
import { activityBarViews, MAX_WINDOW_HEIGHT_COMPACT, COMMIT_ITEM_PADDING } from '../../constants'; import { activityBarViews, MAX_WINDOW_HEIGHT_COMPACT } from '../../constants';
export default { export default {
components: { components: {
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
? this.$refs.formEl && this.$refs.formEl.offsetHeight ? this.$refs.formEl && this.$refs.formEl.offsetHeight
: this.$refs.compactEl && this.$refs.compactEl.offsetHeight; : this.$refs.compactEl && this.$refs.compactEl.offsetHeight;
this.componentHeight = elHeight + COMMIT_ITEM_PADDING; this.componentHeight = elHeight;
}, },
enterTransition() { enterTransition() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
? this.$refs.compactEl && this.$refs.compactEl.offsetHeight ? this.$refs.compactEl && this.$refs.compactEl.offsetHeight
: this.$refs.formEl && this.$refs.formEl.offsetHeight; : this.$refs.formEl && this.$refs.formEl.offsetHeight;
this.componentHeight = elHeight + COMMIT_ITEM_PADDING; this.componentHeight = elHeight;
}); });
}, },
afterEndTransition() { afterEndTransition() {
......
...@@ -122,11 +122,11 @@ export default { ...@@ -122,11 +122,11 @@ export default {
<div <div
class="file" class="file"
:class="fileClass" :class="fileClass"
@click="clickFile"
role="button"
> >
<div <div
class="file-name" class="file-name"
@click="clickFile"
role="button"
> >
<span <span
class="ide-file-name str-truncated" class="ide-file-name str-truncated"
......
...@@ -5,8 +5,6 @@ export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33; ...@@ -5,8 +5,6 @@ export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33;
export const MAX_WINDOW_HEIGHT_COMPACT = 750; export const MAX_WINDOW_HEIGHT_COMPACT = 750;
export const COMMIT_ITEM_PADDING = 32;
// Commit message textarea // Commit message textarea
export const MAX_TITLE_LENGTH = 50; export const MAX_TITLE_LENGTH = 50;
export const MAX_BODY_LENGTH = 72; export const MAX_BODY_LENGTH = 72;
......
...@@ -291,236 +291,8 @@ ul.indent-list { ...@@ -291,236 +291,8 @@ ul.indent-list {
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
} }
.groups-list-tree-container {
.has-no-search-results {
text-align: center;
padding: $gl-padding;
font-style: italic;
color: $well-light-text-color;
}
> .group-list-tree > .group-row.has-children:first-child {
border-top: 0;
}
}
.group-list-tree {
.avatar-container.content-loading {
position: relative;
> a,
> a .avatar {
height: 100%;
border-radius: 50%;
}
> a {
padding: 2px;
.avatar {
border: 2px solid $white-normal;
&.identicon {
line-height: 15px;
}
}
}
&::after {
content: "";
position: absolute;
height: 100%;
width: 100%;
background-color: transparent;
border: 2px outset $kdb-border;
border-radius: 50%;
animation: spin-avatar 3s infinite linear;
}
}
.folder-toggle-wrap {
float: left;
line-height: $list-text-height;
font-size: 0;
span {
font-size: $gl-font-size;
}
}
.folder-caret,
.item-type-icon {
display: inline-block;
}
.folder-caret {
width: 15px;
svg {
margin-bottom: 2px;
}
}
.item-type-icon {
margin-top: 2px;
width: 20px;
}
> .group-row:not(.has-children) {
.folder-caret {
opacity: 0;
}
}
.content-list li:last-child {
padding-bottom: 0;
}
.group-list-tree {
margin-bottom: 0;
margin-left: 30px;
position: relative;
&::before {
content: '';
display: block;
width: 0;
position: absolute;
top: 5px;
bottom: 0;
left: -16px;
border-left: 2px solid $border-white-normal;
}
.group-row {
position: relative;
&::before {
content: "";
display: block;
width: 10px;
height: 0;
border-top: 2px solid $border-white-normal;
position: absolute;
top: 30px;
left: -16px;
}
&:last-child::before {
background: $white-light;
height: auto;
top: 30px;
bottom: 0;
}
&.being-removed {
opacity: 0.5;
}
}
}
.group-row {
padding: 0;
&.has-children {
border-top: 0;
}
&:first-child {
border-top: 1px solid $white-normal;
}
}
.group-row-contents {
padding: $gl-padding-top;
&:hover {
border-color: $row-hover-border;
background-color: $row-hover;
cursor: pointer;
}
.avatar-container > a {
width: 100%;
text-decoration: none;
}
&.has-more-items {
display: block;
padding: 20px 10px;
}
.stats {
position: relative;
line-height: 46px;
> span {
display: inline-flex;
align-items: center;
height: 16px;
min-width: 30px;
}
> span:last-child {
margin-right: 0;
}
.stat-value {
margin: 2px 0 0 5px;
}
}
.controls {
margin-left: 5px;
> .btn {
margin-right: $btn-xs-side-margin;
}
}
}
.project-row-contents .stats {
line-height: inherit;
> span:first-child {
margin-left: 25px;
}
.item-visibility {
margin-right: 0;
}
.last-updated {
position: absolute;
right: 12px;
min-width: 250px;
text-align: right;
color: $gl-text-color-secondary;
}
}
}
.namespace-title { .namespace-title {
.tooltip-inner { .tooltip-inner {
max-width: 350px; max-width: 350px;
} }
} }
ul.group-list-tree {
li.group-row {
> .group-row-contents .title {
line-height: $list-text-height;
}
&.has-description > .group-row-contents .title {
line-height: inherit;
}
}
}
.js-groups-list-holder {
.groups-list-loading {
font-size: 34px;
text-align: center;
}
}
...@@ -290,3 +290,231 @@ table.pipeline-project-metrics tr td { ...@@ -290,3 +290,231 @@ table.pipeline-project-metrics tr td {
overflow-y: unset; overflow-y: unset;
} }
} }
.groups-list-tree-container {
.has-no-search-results {
text-align: center;
padding: $gl-padding;
font-style: italic;
color: $well-light-text-color;
}
> .group-list-tree > .group-row.has-children:first-child {
border-top: 0;
}
}
.group-list-tree {
.avatar-container.content-loading {
position: relative;
> a,
> a .avatar {
height: 100%;
border-radius: 50%;
}
> a {
padding: 2px;
.avatar {
border: 2px solid $white-normal;
&.identicon {
line-height: 15px;
}
}
}
&::after {
content: "";
position: absolute;
height: 100%;
width: 100%;
background-color: transparent;
border: 2px outset $kdb-border;
border-radius: 50%;
animation: spin-avatar 3s infinite linear;
}
}
.folder-toggle-wrap {
float: left;
line-height: $list-text-height;
font-size: 0;
span {
font-size: $gl-font-size;
}
}
.folder-caret,
.item-type-icon {
display: inline-block;
}
.folder-caret {
width: 15px;
svg {
margin-bottom: 2px;
}
}
.item-type-icon {
margin-top: 2px;
width: 20px;
}
> .group-row:not(.has-children) {
.folder-caret {
opacity: 0;
}
}
.content-list li:last-child {
padding-bottom: 0;
}
.group-list-tree {
margin-bottom: 0;
margin-left: 30px;
position: relative;
&::before {
content: '';
display: block;
width: 0;
position: absolute;
top: 5px;
bottom: 0;
left: -16px;
border-left: 2px solid $border-white-normal;
}
.group-row {
position: relative;
&::before {
content: "";
display: block;
width: 10px;
height: 0;
border-top: 2px solid $border-white-normal;
position: absolute;
top: 30px;
left: -16px;
}
&:last-child::before {
background: $white-light;
height: auto;
top: 30px;
bottom: 0;
}
&.being-removed {
opacity: 0.5;
}
}
}
.group-row {
padding: 0;
&.has-children {
border-top: 0;
}
&:first-child {
border-top: 1px solid $white-normal;
}
}
.group-row-contents {
padding: $gl-padding-top;
&:hover {
border-color: $row-hover-border;
background-color: $row-hover;
cursor: pointer;
}
.avatar-container > a {
width: 100%;
text-decoration: none;
}
&.has-more-items {
display: block;
padding: 20px 10px;
}
.stats {
position: relative;
line-height: 46px;
> span {
display: inline-flex;
align-items: center;
height: 16px;
min-width: 30px;
}
> span:last-child {
margin-right: 0;
}
.stat-value {
margin: 2px 0 0 5px;
}
}
.controls {
margin-left: 5px;
> .btn {
margin-right: $btn-xs-side-margin;
}
}
}
.project-row-contents .stats {
line-height: inherit;
> span:first-child {
margin-left: 25px;
}
.item-visibility {
margin-right: 0;
}
.last-updated {
position: absolute;
right: 12px;
min-width: 250px;
text-align: right;
color: $gl-text-color-secondary;
}
}
}
ul.group-list-tree {
li.group-row {
> .group-row-contents .title {
line-height: $list-text-height;
}
&.has-description > .group-row-contents .title {
line-height: inherit;
}
}
}
.js-groups-list-holder {
.groups-list-loading {
font-size: 34px;
text-align: center;
}
}
...@@ -39,12 +39,15 @@ ...@@ -39,12 +39,15 @@
.ide-file-list { .ide-file-list {
flex: 1; flex: 1;
padding-left: $gl-padding;
padding-right: $gl-padding;
padding-bottom: $grid-size;
.file { .file {
cursor: pointer; cursor: pointer;
&.file-open { &.file-open {
background: $link-active-background; background: $white-normal;
} }
&.file-active { &.file-active {
...@@ -84,12 +87,11 @@ ...@@ -84,12 +87,11 @@
.ide-new-btn { .ide-new-btn {
display: none; display: none;
margin-right: -8px;
} }
&:hover, &:hover,
&:focus { &:focus {
background: $link-active-background; background: $white-normal;
.ide-new-btn { .ide-new-btn {
display: block; display: block;
...@@ -111,12 +113,11 @@ ...@@ -111,12 +113,11 @@
} }
} }
.file-name, .file-name {
.file-col-commit-message {
display: flex; display: flex;
overflow: visible; overflow: visible;
align-items: center; align-items: center;
padding: 6px 12px; width: 100%;
} }
.multi-file-loading-container { .multi-file-loading-container {
...@@ -507,7 +508,7 @@ ...@@ -507,7 +508,7 @@
align-items: center; align-items: center;
margin-bottom: 0; margin-bottom: 0;
border-bottom: 1px solid $white-dark; border-bottom: 1px solid $white-dark;
padding: $gl-btn-padding $gl-padding; padding: 12px 0;
} }
.multi-file-commit-panel-header-title { .multi-file-commit-panel-header-title {
...@@ -529,32 +530,31 @@ ...@@ -529,32 +530,31 @@
.multi-file-commit-list { .multi-file-commit-list {
flex: 1; flex: 1;
overflow: auto; overflow: auto;
padding: $gl-padding; padding: $grid-size 0;
margin-left: -$grid-size;
margin-right: -$grid-size;
min-height: 60px; min-height: 60px;
.multi-file-commit-list-item {
margin-left: 0;
margin-right: 0;
}
&.help-block {
margin-left: 0;
right: 0;
}
} }
.multi-file-commit-list-item { .multi-file-commit-list-item {
display: flex;
padding: 0;
align-items: center;
border-radius: $border-radius-default;
.multi-file-discard-btn { .multi-file-discard-btn {
display: none; display: none;
margin-top: -2px; margin-top: -2px;
margin-left: auto; margin-left: auto;
margin-right: $grid-size;
color: $gl-link-color; color: $gl-link-color;
&:focus,
&:hover {
text-decoration: underline;
}
} }
&:hover { &:hover {
background: $white-normal;
.multi-file-discard-btn { .multi-file-discard-btn {
display: flex; display: flex;
} }
...@@ -590,25 +590,39 @@ ...@@ -590,25 +590,39 @@
} }
} }
.multi-file-commit-list-item,
.ide-file-list .file {
display: flex;
align-items: center;
margin-left: -$grid-size;
margin-right: -$grid-size;
padding: $grid-size / 2 $grid-size;
border-radius: $border-radius-default;
text-align: left;
&:hover,
&:focus {
background: $white-normal;
}
}
.multi-file-commit-list-path { .multi-file-commit-list-path {
padding: $grid-size / 2; padding: 0;
padding-left: $grid-size;
background: none; background: none;
border: 0; border: 0;
text-align: left; text-align: left;
width: 100%; width: 100%;
min-width: 0;
&:hover,
&:focus {
outline: 0;
}
svg { svg {
min-width: 16px; min-width: 16px;
vertical-align: middle; vertical-align: middle;
display: inline-block; display: inline-block;
} }
&:hover,
&:focus {
outline: 0;
}
} }
.multi-file-commit-list-file-path { .multi-file-commit-list-file-path {
...@@ -625,12 +639,18 @@ ...@@ -625,12 +639,18 @@
.multi-file-commit-form { .multi-file-commit-form {
position: relative; position: relative;
padding: $gl-padding;
background-color: $white-light; background-color: $white-light;
border-top: 1px solid $white-dark;
border-left: 1px solid $white-dark; border-left: 1px solid $white-dark;
transition: all 0.3s ease; transition: all 0.3s ease;
> form,
> .commit-form-compact {
padding: $gl-padding 0;
margin-left: $gl-padding;
margin-right: $gl-padding;
border-top: 1px solid $white-dark;
}
.btn { .btn {
font-size: $gl-font-size; font-size: $gl-font-size;
} }
...@@ -793,8 +813,9 @@ ...@@ -793,8 +813,9 @@
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
width: 100%;
min-height: 140px; min-height: 140px;
margin-left: $gl-padding;
margin-right: $gl-padding;
&.is-first { &.is-first {
border-bottom: 1px solid $white-dark; border-bottom: 1px solid $white-dark;
...@@ -985,9 +1006,8 @@ ...@@ -985,9 +1006,8 @@
.ide-tree-header { .ide-tree-header {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 10px 0; margin-bottom: 8px;
margin-left: 10px; padding: 12px 0;
margin-right: 10px;
border-bottom: 1px solid $white-dark; border-bottom: 1px solid $white-dark;
.ide-new-btn { .ide-new-btn {
...@@ -1018,9 +1038,9 @@ ...@@ -1018,9 +1038,9 @@
.commit-form-slide-up-enter-active, .commit-form-slide-up-enter-active,
.commit-form-slide-up-leave-active { .commit-form-slide-up-leave-active {
position: absolute; position: absolute;
top: 16px; top: 0;
left: 16px; left: 0;
right: 16px; right: 0;
transition: all 0.3s ease; transition: all 0.3s ease;
} }
......
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts]) do = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts]) do
= link_to project_pipelines_path(@project), class: 'shortcuts-pipelines' do = link_to project_pipelines_path(@project), class: 'shortcuts-pipelines' do
.nav-icon-container .nav-icon-container
= sprite_icon('pipeline') = sprite_icon('rocket')
%span.nav-item-name %span.nav-item-name
= _('CI / CD') = _('CI / CD')
......
---
title: Memoize Gitlab::Database.version
merge_request:
author:
type: performance
---
title: Remove shellout implementation for Repository checksums
merge_request:
author:
type: other
...@@ -37,12 +37,13 @@ import state from './state'; ...@@ -37,12 +37,13 @@ import state from './state';
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export const createStore = () => new Vuex.Store({
actions, actions,
getters, getters,
mutations, mutations,
state, state,
}); });
export default createStore();
``` ```
### `state.js` ### `state.js`
...@@ -320,10 +321,11 @@ In order to write unit tests for those components, we need to include the store ...@@ -320,10 +321,11 @@ In order to write unit tests for those components, we need to include the store
```javascript ```javascript
//component_spec.js //component_spec.js
import Vue from 'vue'; import Vue from 'vue';
import store from './store'; import { createStore } from './store';
import component from './component.vue' import component from './component.vue'
describe('component', () => { describe('component', () => {
let store;
let vm; let vm;
let Component; let Component;
...@@ -340,6 +342,8 @@ describe('component', () => { ...@@ -340,6 +342,8 @@ describe('component', () => {
name: 'Foo', name: 'Foo',
age: '30', age: '30',
}; };
store = createStore();
// populate the store // populate the store
store.dispatch('addUser', user); store.dispatch('addUser', user);
......
...@@ -6,8 +6,11 @@ module Gitlab ...@@ -6,8 +6,11 @@ module Gitlab
module Auth module Auth
module LDAP module LDAP
class Access class Access
<<<<<<< HEAD
prepend ::EE::Gitlab::Auth::LDAP::Access prepend ::EE::Gitlab::Auth::LDAP::Access
=======
>>>>>>> upstream/master
attr_reader :provider, :user, :ldap_identity attr_reader :provider, :user, :ldap_identity
def self.open(user, &block) def self.open(user, &block)
......
...@@ -43,7 +43,7 @@ module Gitlab ...@@ -43,7 +43,7 @@ module Gitlab
end end
def self.version def self.version
database_version.match(/\A(?:PostgreSQL |)([^\s]+).*\z/)[1] @version ||= database_version.match(/\A(?:PostgreSQL |)([^\s]+).*\z/)[1]
end end
def self.postgresql_9_or_less? def self.postgresql_9_or_less?
......
...@@ -1586,14 +1586,12 @@ module Gitlab ...@@ -1586,14 +1586,12 @@ module Gitlab
end end
def checksum def checksum
gitaly_migrate(:calculate_checksum, # The exists? RPC is much cheaper, so we perform this request first
status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled| raise NoRepository, "Repository does not exists" unless exists?
if is_enabled
gitaly_repository_client.calculate_checksum gitaly_repository_client.calculate_checksum
else rescue GRPC::NotFound
calculate_checksum_by_shelling_out raise NoRepository # Guard against data races.
end
end
end end
private private
...@@ -2500,36 +2498,6 @@ module Gitlab ...@@ -2500,36 +2498,6 @@ module Gitlab
rev_parse_target(ref).oid rev_parse_target(ref).oid
end end
def calculate_checksum_by_shelling_out
raise NoRepository unless exists?
args = %W(--git-dir=#{path} show-ref --heads --tags)
output, status = run_git(args)
if status.nil? || !status.zero?
# Non-valid git repositories return 128 as the status code and an error output
raise InvalidRepository if status == 128 && output.to_s.downcase =~ /not a git repository/
# Empty repositories returns with a non-zero status and an empty output.
raise ChecksumError, output unless output.blank?
return EMPTY_REPOSITORY_CHECKSUM
end
refs = output.split("\n")
result = refs.inject(nil) do |checksum, ref|
value = Digest::SHA1.hexdigest(ref).hex
if checksum.nil?
value
else
checksum ^ value
end
end
result.to_s(16)
end
def build_git_cmd(*args) def build_git_cmd(*args)
object_directories = alternate_object_directories.join(File::PATH_SEPARATOR) object_directories = alternate_object_directories.join(File::PATH_SEPARATOR)
......
...@@ -32,6 +32,12 @@ describe Gitlab::Database do ...@@ -32,6 +32,12 @@ describe Gitlab::Database do
end end
describe '.version' do describe '.version' do
around do |example|
described_class.instance_variable_set(:@version, nil)
example.run
described_class.instance_variable_set(:@version, nil)
end
context "on mysql" do context "on mysql" do
it "extracts the version number" do it "extracts the version number" do
allow(described_class).to receive(:database_version) allow(described_class).to receive(:database_version)
...@@ -49,6 +55,14 @@ describe Gitlab::Database do ...@@ -49,6 +55,14 @@ describe Gitlab::Database do
expect(described_class.version).to eq '9.4.4' expect(described_class.version).to eq '9.4.4'
end end
end end
it 'memoizes the result' do
count = ActiveRecord::QueryRecorder
.new { 2.times { described_class.version } }
.count
expect(count).to eq(1)
end
end end
describe '.postgresql_9_or_less?' do describe '.postgresql_9_or_less?' do
......
...@@ -2247,66 +2247,42 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -2247,66 +2247,42 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
describe '#checksum' do describe '#checksum' do
shared_examples 'calculating checksum' do it 'calculates the checksum for non-empty repo' do
it 'calculates the checksum for non-empty repo' do expect(repository.checksum).to eq '54f21be4c32c02f6788d72207fa03ad3bce725e4'
expect(repository.checksum).to eq '54f21be4c32c02f6788d72207fa03ad3bce725e4' end
end
it 'returns 0000000000000000000000000000000000000000 for an empty repo' do
FileUtils.rm_rf(File.join(storage_path, 'empty-repo.git'))
system(git_env, *%W(#{Gitlab.config.git.bin_path} init --bare empty-repo.git),
chdir: storage_path,
out: '/dev/null',
err: '/dev/null')
empty_repo = described_class.new('default', 'empty-repo.git', '') it 'returns 0000000000000000000000000000000000000000 for an empty repo' do
FileUtils.rm_rf(File.join(storage_path, 'empty-repo.git'))
expect(empty_repo.checksum).to eq '0000000000000000000000000000000000000000' system(git_env, *%W(#{Gitlab.config.git.bin_path} init --bare empty-repo.git),
end chdir: storage_path,
out: '/dev/null',
err: '/dev/null')
it 'raises Gitlab::Git::Repository::InvalidRepository error for non-valid git repo' do empty_repo = described_class.new('default', 'empty-repo.git', '')
FileUtils.rm_rf(File.join(storage_path, 'non-valid.git'))
system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{TEST_REPO_PATH} non-valid.git), expect(empty_repo.checksum).to eq '0000000000000000000000000000000000000000'
chdir: SEED_STORAGE_PATH, end
out: '/dev/null',
err: '/dev/null')
File.truncate(File.join(storage_path, 'non-valid.git/HEAD'), 0) it 'raises Gitlab::Git::Repository::InvalidRepository error for non-valid git repo' do
FileUtils.rm_rf(File.join(storage_path, 'non-valid.git'))
non_valid = described_class.new('default', 'non-valid.git', '') system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{TEST_REPO_PATH} non-valid.git),
chdir: SEED_STORAGE_PATH,
out: '/dev/null',
err: '/dev/null')
expect { non_valid.checksum }.to raise_error(Gitlab::Git::Repository::InvalidRepository) File.truncate(File.join(storage_path, 'non-valid.git/HEAD'), 0)
end
it 'raises Gitlab::Git::Repository::NoRepository error when there is no repo' do non_valid = described_class.new('default', 'non-valid.git', '')
broken_repo = described_class.new('default', 'a/path.git', '')
expect { broken_repo.checksum }.to raise_error(Gitlab::Git::Repository::NoRepository) expect { non_valid.checksum }.to raise_error(Gitlab::Git::Repository::InvalidRepository)
end
end end
context 'when calculate_checksum Gitaly feature is enabled' do it 'raises Gitlab::Git::Repository::NoRepository error when there is no repo' do
it_behaves_like 'calculating checksum' broken_repo = described_class.new('default', 'a/path.git', '')
end
context 'when calculate_checksum Gitaly feature is disabled', :disable_gitaly do
it_behaves_like 'calculating checksum'
describe 'when storage is broken', :broken_storage do
it 'raises a storage exception when storage is not available' do
broken_repo = described_class.new('broken', 'a/path.git', '')
expect { broken_repo.rugged }.to raise_error(Gitlab::Git::Storage::Inaccessible)
end
end
it "raises a Gitlab::Git::Repository::Failure error if the `popen` call to git returns a non-zero exit code" do
allow(repository).to receive(:popen).and_return(['output', nil])
expect { repository.checksum }.to raise_error Gitlab::Git::Repository::ChecksumError expect { broken_repo.checksum }.to raise_error(Gitlab::Git::Repository::NoRepository)
end
end 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