Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
65f83941
Commit
65f83941
authored
Aug 22, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make gl_repository a G::G::Repository attribute
parent
9b930932
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
53 additions
and
48 deletions
+53
-48
app/models/repository.rb
app/models/repository.rb
+1
-1
app/services/git_hooks_service.rb
app/services/git_hooks_service.rb
+4
-4
app/services/git_operation_service.rb
app/services/git_operation_service.rb
+1
-1
db/migrate/20140502125220_migrate_repo_size.rb
db/migrate/20140502125220_migrate_repo_size.rb
+1
-1
lib/gitlab/git/hook.rb
lib/gitlab/git/hook.rb
+8
-5
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+3
-2
spec/lib/gitlab/git/blame_spec.rb
spec/lib/gitlab/git/blame_spec.rb
+1
-1
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+1
-1
spec/lib/gitlab/git/branch_spec.rb
spec/lib/gitlab/git/branch_spec.rb
+1
-1
spec/lib/gitlab/git/commit_spec.rb
spec/lib/gitlab/git/commit_spec.rb
+4
-4
spec/lib/gitlab/git/compare_spec.rb
spec/lib/gitlab/git/compare_spec.rb
+1
-1
spec/lib/gitlab/git/diff_spec.rb
spec/lib/gitlab/git/diff_spec.rb
+1
-1
spec/lib/gitlab/git/hook_spec.rb
spec/lib/gitlab/git/hook_spec.rb
+5
-4
spec/lib/gitlab/git/index_spec.rb
spec/lib/gitlab/git/index_spec.rb
+1
-1
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+16
-16
spec/lib/gitlab/git/tag_spec.rb
spec/lib/gitlab/git/tag_spec.rb
+1
-1
spec/lib/gitlab/git/tree_spec.rb
spec/lib/gitlab/git/tree_spec.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+2
-2
No files found.
app/models/repository.rb
View file @
65f83941
...
...
@@ -1194,7 +1194,7 @@ class Repository
end
def
initialize_raw_repository
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
disk_path
+
'.git'
)
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
disk_path
+
'.git'
,
Gitlab
::
GlRepository
.
gl_repository
(
project
,
false
)
)
end
def
circuit_breaker
...
...
app/services/git_hooks_service.rb
View file @
65f83941
...
...
@@ -3,9 +3,9 @@ class GitHooksService
attr_accessor
:oldrev
,
:newrev
,
:ref
def
execute
(
committer
,
project
,
oldrev
,
newrev
,
ref
)
@
project
=
project
@gl_id
=
committer
.
gl_id
def
execute
(
committer
,
repository
,
oldrev
,
newrev
,
ref
)
@
repository
=
repository
@gl_id
=
committer
.
gl_id
@oldrev
=
oldrev
@newrev
=
newrev
@ref
=
ref
...
...
@@ -26,7 +26,7 @@ class GitHooksService
private
def
run_hook
(
name
)
hook
=
Gitlab
::
Git
::
Hook
.
new
(
name
,
@
project
)
hook
=
Gitlab
::
Git
::
Hook
.
new
(
name
,
@
repository
)
hook
.
trigger
(
@gl_id
,
oldrev
,
newrev
,
ref
)
end
end
app/services/git_operation_service.rb
View file @
65f83941
...
...
@@ -123,7 +123,7 @@ class GitOperationService
def
with_hooks
(
ref
,
newrev
,
oldrev
)
GitHooksService
.
new
.
execute
(
committer
,
repository
.
project
,
repository
,
oldrev
,
newrev
,
ref
)
do
|
service
|
...
...
db/migrate/20140502125220_migrate_repo_size.rb
View file @
65f83941
...
...
@@ -11,7 +11,7 @@ class MigrateRepoSize < ActiveRecord::Migration
path
=
File
.
join
(
namespace_path
,
project
[
'project_path'
]
+
'.git'
)
begin
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
path
)
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
path
,
''
)
if
repo
.
empty?
print
'-'
else
...
...
lib/gitlab/git/hook.rb
View file @
65f83941
...
...
@@ -6,15 +6,18 @@ module Gitlab
module
Git
class
Hook
GL_PROTOCOL
=
'web'
.
freeze
attr_reader
:name
,
:
repo_path
,
:path
attr_reader
:name
,
:
path
,
:repository
def
initialize
(
name
,
project
)
def
initialize
(
name
,
repository
)
@name
=
name
@project
=
project
@repo_path
=
project
.
repository
.
path
@repository
=
repository
@path
=
File
.
join
(
repo_path
.
strip
,
'hooks'
,
name
)
end
def
repo_path
repository
.
path
end
def
exists?
File
.
exist?
(
path
)
end
...
...
@@ -44,7 +47,7 @@ module Gitlab
'GL_ID'
=>
gl_id
,
'PWD'
=>
repo_path
,
'GL_PROTOCOL'
=>
GL_PROTOCOL
,
'GL_REPOSITORY'
=>
Gitlab
::
GlRepository
.
gl_repository
(
@project
,
false
)
'GL_REPOSITORY'
=>
repository
.
gl_repository
}
options
=
{
...
...
lib/gitlab/git/repository.rb
View file @
65f83941
...
...
@@ -49,13 +49,14 @@ module Gitlab
# Rugged repo object
attr_reader
:rugged
attr_reader
:storage
attr_reader
:storage
,
:gl_repository
,
:relative_path
# 'path' must be the path to a _bare_ git repository, e.g.
# /path/to/my-repo.git
def
initialize
(
storage
,
relative_path
)
def
initialize
(
storage
,
relative_path
,
gl_repository
)
@storage
=
storage
@relative_path
=
relative_path
@gl_repository
=
gl_repository
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
][
'path'
]
@path
=
File
.
join
(
storage_path
,
@relative_path
)
...
...
spec/lib/gitlab/git/blame_spec.rb
View file @
65f83941
...
...
@@ -2,7 +2,7 @@
require
"spec_helper"
describe
Gitlab
::
Git
::
Blame
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
let
(
:blame
)
do
Gitlab
::
Git
::
Blame
.
new
(
repository
,
SeedRepo
::
Commit
::
ID
,
"CONTRIBUTING.md"
)
end
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
65f83941
...
...
@@ -3,7 +3,7 @@
require
"spec_helper"
describe
Gitlab
::
Git
::
Blob
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
describe
'initialize'
do
let
(
:blob
)
{
Gitlab
::
Git
::
Blob
.
new
(
name:
'test'
)
}
...
...
spec/lib/gitlab/git/branch_spec.rb
View file @
65f83941
require
"spec_helper"
describe
Gitlab
::
Git
::
Branch
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
subject
{
repository
.
branches
}
...
...
spec/lib/gitlab/git/commit_spec.rb
View file @
65f83941
require
"spec_helper"
describe
Gitlab
::
Git
::
Commit
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
let
(
:commit
)
{
described_class
.
find
(
repository
,
SeedRepo
::
Commit
::
ID
)
}
let
(
:rugged_commit
)
do
repository
.
rugged
.
lookup
(
SeedRepo
::
Commit
::
ID
)
...
...
@@ -9,7 +9,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
describe
"Commit info"
do
before
do
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
).
rugged
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
).
rugged
@committer
=
{
email:
'mike@smith.com'
,
...
...
@@ -59,7 +59,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
after
do
# Erase the new commit so other tests get the original repo
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
).
rugged
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
).
rugged
repo
.
references
.
update
(
"refs/heads/master"
,
SeedRepo
::
LastCommit
::
ID
)
end
end
...
...
@@ -144,7 +144,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end
context
'with broken repo'
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_BROKEN_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_BROKEN_REPO_PATH
,
''
)
}
it
'returns nil'
do
expect
(
described_class
.
find
(
repository
,
SeedRepo
::
Commit
::
ID
)).
to
be_nil
...
...
spec/lib/gitlab/git/compare_spec.rb
View file @
65f83941
require
"spec_helper"
describe
Gitlab
::
Git
::
Compare
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
let
(
:compare
)
{
Gitlab
::
Git
::
Compare
.
new
(
repository
,
SeedRepo
::
BigCommit
::
ID
,
SeedRepo
::
Commit
::
ID
,
straight:
false
)
}
let
(
:compare_straight
)
{
Gitlab
::
Git
::
Compare
.
new
(
repository
,
SeedRepo
::
BigCommit
::
ID
,
SeedRepo
::
Commit
::
ID
,
straight:
true
)
}
...
...
spec/lib/gitlab/git/diff_spec.rb
View file @
65f83941
require
"spec_helper"
describe
Gitlab
::
Git
::
Diff
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
before
do
@raw_diff_hash
=
{
...
...
spec/lib/gitlab/git/hook_spec.rb
View file @
65f83941
...
...
@@ -10,7 +10,8 @@ describe Gitlab::Git::Hook do
describe
"#trigger"
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repo_path
)
{
project
.
repository
.
path
}
let
(
:repository
)
{
project
.
repository
.
raw_repository
}
let
(
:repo_path
)
{
repository
.
path
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:gl_id
)
{
Gitlab
::
GlId
.
gl_id
(
user
)
}
...
...
@@ -48,7 +49,7 @@ describe Gitlab::Git::Hook do
it
"returns success with no errors"
do
create_hook
(
hook_name
)
hook
=
described_class
.
new
(
hook_name
,
project
)
hook
=
described_class
.
new
(
hook_name
,
repository
)
blank
=
Gitlab
::
Git
::
BLANK_SHA
ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
'new_branch'
...
...
@@ -66,7 +67,7 @@ describe Gitlab::Git::Hook do
context
"when the hook is unsuccessful"
do
it
"returns failure with errors"
do
create_failing_hook
(
hook_name
)
hook
=
described_class
.
new
(
hook_name
,
project
)
hook
=
described_class
.
new
(
hook_name
,
repository
)
blank
=
Gitlab
::
Git
::
BLANK_SHA
ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
'new_branch'
...
...
@@ -80,7 +81,7 @@ describe Gitlab::Git::Hook do
context
"when the hook doesn't exist"
do
it
"returns success with no errors"
do
hook
=
described_class
.
new
(
'unknown_hook'
,
project
)
hook
=
described_class
.
new
(
'unknown_hook'
,
repository
)
blank
=
Gitlab
::
Git
::
BLANK_SHA
ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
'new_branch'
...
...
spec/lib/gitlab/git/index_spec.rb
View file @
65f83941
require
'spec_helper'
describe
Gitlab
::
Git
::
Index
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
let
(
:index
)
{
described_class
.
new
(
repository
)
}
before
do
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
65f83941
...
...
@@ -17,7 +17,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
describe
"Respond to"
do
subject
{
repository
}
...
...
@@ -56,14 +56,14 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#rugged"
do
describe
'when storage is broken'
,
broken_storage:
true
do
it
'raises a storage exception when storage is not available'
do
broken_repo
=
described_class
.
new
(
'broken'
,
'a/path.git'
)
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 no repository exception when there is no repo'
do
broken_repo
=
described_class
.
new
(
'default'
,
'a/path.git'
)
broken_repo
=
described_class
.
new
(
'default'
,
'a/path.git'
,
''
)
expect
{
broken_repo
.
rugged
}.
to
raise_error
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
end
...
...
@@ -257,7 +257,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
describe
'#submodule_url_for'
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
let
(
:ref
)
{
'master'
}
def
submodule_url
(
path
)
...
...
@@ -295,7 +295,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
context
'#submodules'
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
context
'where repo has submodules'
do
let
(
:submodules
)
{
repository
.
send
(
:submodules
,
'master'
)
}
...
...
@@ -391,7 +391,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#delete_branch"
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
@repo
.
delete_branch
(
"feature"
)
end
...
...
@@ -407,7 +407,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#create_branch"
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
end
it
"should create a new branch"
do
...
...
@@ -445,7 +445,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#remote_delete"
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
@repo
.
remote_delete
(
"expendable"
)
end
...
...
@@ -461,7 +461,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#remote_add"
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
@repo
.
remote_add
(
"new_remote"
,
SeedHelper
::
GITLAB_GIT_TEST_REPO_URL
)
end
...
...
@@ -477,7 +477,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
"#remote_update"
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
@repo
.
remote_update
(
"expendable"
,
url:
TEST_NORMAL_REPO_PATH
)
end
...
...
@@ -506,7 +506,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
before
(
:context
)
do
# Add new commits so that there's a renamed file in the commit history
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
).
rugged
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
).
rugged
@commit_with_old_name_id
=
new_commit_edit_old_file
(
repo
)
@rename_commit_id
=
new_commit_move_file
(
repo
)
@commit_with_new_name_id
=
new_commit_edit_new_file
(
repo
)
...
...
@@ -514,7 +514,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
after
(
:context
)
do
# Erase our commits so other tests get the original repo
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
).
rugged
repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
).
rugged
repo
.
references
.
update
(
"refs/heads/master"
,
SeedRepo
::
LastCommit
::
ID
)
end
...
...
@@ -849,7 +849,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
'#autocrlf'
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
@repo
.
rugged
.
config
[
'core.autocrlf'
]
=
true
end
...
...
@@ -864,7 +864,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
'#autocrlf='
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
)
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
@repo
.
rugged
.
config
[
'core.autocrlf'
]
=
false
end
...
...
@@ -933,7 +933,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
context
'with local and remote branches'
do
let
(
:repository
)
do
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
File
.
join
(
TEST_MUTABLE_REPO_PATH
,
'.git'
))
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
File
.
join
(
TEST_MUTABLE_REPO_PATH
,
'.git'
)
,
''
)
end
before
do
...
...
@@ -1128,7 +1128,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe
'#local_branches'
do
before
(
:all
)
do
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
File
.
join
(
TEST_MUTABLE_REPO_PATH
,
'.git'
))
@repo
=
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
File
.
join
(
TEST_MUTABLE_REPO_PATH
,
'.git'
)
,
''
)
end
after
(
:all
)
do
...
...
spec/lib/gitlab/git/tag_spec.rb
View file @
65f83941
require
"spec_helper"
describe
Gitlab
::
Git
::
Tag
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
shared_examples
'Gitlab::Git::Repository#tags'
do
describe
'first tag'
do
...
...
spec/lib/gitlab/git/tree_spec.rb
View file @
65f83941
require
"spec_helper"
describe
Gitlab
::
Git
::
Tree
,
seed_helper:
true
do
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
''
)
}
context
:repo
do
let
(
:tree
)
{
Gitlab
::
Git
::
Tree
.
where
(
repository
,
SeedRepo
::
Commit
::
ID
)
}
...
...
spec/models/repository_spec.rb
View file @
65f83941
...
...
@@ -886,7 +886,7 @@ describe Repository, models: true do
context
'when pre hooks were successful'
do
it
'runs without errors'
do
expect_any_instance_of
(
GitHooksService
).
to
receive
(
:execute
)
.
with
(
committer
,
project
,
old_rev
,
blank_sha
,
'refs/heads/feature'
)
.
with
(
committer
,
repository
,
old_rev
,
blank_sha
,
'refs/heads/feature'
)
expect
{
repository
.
rm_branch
(
user
,
'feature'
)
}.
not_to
raise_error
end
...
...
@@ -929,7 +929,7 @@ describe Repository, models: true do
service
=
GitHooksService
.
new
expect
(
GitHooksService
).
to
receive
(
:new
).
and_return
(
service
)
expect
(
service
).
to
receive
(
:execute
)
.
with
(
committer
,
project
,
old_rev
,
new_rev
,
'refs/heads/feature'
)
.
with
(
committer
,
repository
,
old_rev
,
new_rev
,
'refs/heads/feature'
)
.
and_yield
(
service
).
and_return
(
true
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment