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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
bafa7156
Commit
bafa7156
authored
Oct 19, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create a Wiki Repository's raw_repository properly
parent
0e4f9d04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
app/models/project_wiki.rb
app/models/project_wiki.rb
+1
-1
app/models/repository.rb
app/models/repository.rb
+4
-3
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+20
-0
No files found.
app/models/project_wiki.rb
View file @
bafa7156
...
...
@@ -150,7 +150,7 @@ class ProjectWiki
end
def
repository
@repository
||=
Repository
.
new
(
full_path
,
@project
,
disk_path:
disk_path
)
@repository
||=
Repository
.
new
(
full_path
,
@project
,
disk_path:
disk_path
,
is_wiki:
true
)
end
def
default_branch
...
...
app/models/repository.rb
View file @
bafa7156
...
...
@@ -21,7 +21,7 @@ class Repository
include
RepositoryMirroring
prepend
EE
::
Repository
attr_accessor
:full_path
,
:disk_path
,
:project
attr_accessor
:full_path
,
:disk_path
,
:project
,
:is_wiki
delegate
:ref_name_for_sha
,
to: :raw_repository
...
...
@@ -79,11 +79,12 @@ class Repository
end
end
def
initialize
(
full_path
,
project
,
disk_path:
nil
)
def
initialize
(
full_path
,
project
,
disk_path:
nil
,
is_wiki:
false
)
@full_path
=
full_path
@disk_path
=
disk_path
||
full_path
@project
=
project
@commit_cache
=
{}
@is_wiki
=
is_wiki
end
def
==
(
other
)
...
...
@@ -1202,7 +1203,7 @@ class Repository
end
def
initialize_raw_repository
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
disk_path
+
'.git'
,
Gitlab
::
GlRepository
.
gl_repository
(
project
,
false
))
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
disk_path
+
'.git'
,
Gitlab
::
GlRepository
.
gl_repository
(
project
,
is_wiki
))
end
def
find_commits_by_message_by_shelling_out
(
query
,
ref
,
path
,
limit
,
offset
)
...
...
spec/models/repository_spec.rb
View file @
bafa7156
...
...
@@ -2430,4 +2430,24 @@ describe Repository do
project
.
commit_by
(
oid:
'1'
*
40
)
end
end
describe
'#raw_repository'
do
subject
{
repository
.
raw_repository
}
it
'returns a Gitlab::Git::Repository representation of the repository'
do
expect
(
subject
).
to
be_a
(
Gitlab
::
Git
::
Repository
)
expect
(
subject
.
relative_path
).
to
eq
(
project
.
disk_path
+
'.git'
)
expect
(
subject
.
gl_repository
).
to
eq
(
"project-
#{
project
.
id
}
"
)
end
context
'with a wiki repository'
do
let
(
:repository
)
{
project
.
wiki
.
repository
}
it
'creates a Gitlab::Git::Repository with the proper attributes'
do
expect
(
subject
).
to
be_a
(
Gitlab
::
Git
::
Repository
)
expect
(
subject
.
relative_path
).
to
eq
(
project
.
disk_path
+
'.wiki.git'
)
expect
(
subject
.
gl_repository
).
to
eq
(
"wiki-
#{
project
.
id
}
"
)
end
end
end
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