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
Léo-Paul Géneau
gitlab-ce
Commits
9a26e9a0
Commit
9a26e9a0
authored
Apr 01, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dont init repo on every create(:repo)
parent
541d8994
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
11 deletions
+18
-11
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+0
-4
app/models/gollum_wiki.rb
app/models/gollum_wiki.rb
+5
-1
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+4
-0
spec/factories.rb
spec/factories.rb
+5
-3
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+1
-1
spec/models/gollum_wiki_spec.rb
spec/models/gollum_wiki_spec.rb
+1
-1
spec/support/test_env.rb
spec/support/test_env.rb
+2
-1
No files found.
app/helpers/commits_helper.rb
View file @
9a26e9a0
...
@@ -147,10 +147,6 @@ module CommitsHelper
...
@@ -147,10 +147,6 @@ module CommitsHelper
protected
protected
def
no_commit_message
"--no commit message"
end
# Private: Returns a link to a person. If the person has a matching user and
# Private: Returns a link to a person. If the person has a matching user and
# is a member of the current @project it will link to the team member page.
# is a member of the current @project it will link to the team member page.
# Otherwise it will link to the person email as specified in the commit.
# Otherwise it will link to the person email as specified in the commit.
...
...
app/models/gollum_wiki.rb
View file @
9a26e9a0
...
@@ -90,13 +90,17 @@ class GollumWiki
...
@@ -90,13 +90,17 @@ class GollumWiki
private
private
def
create_repo!
def
create_repo!
if
gitlab_shell
.
add_repository
(
path_with_namespace
)
if
init_repo
(
path_with_namespace
)
Gollum
::
Wiki
.
new
(
path_to_repo
)
Gollum
::
Wiki
.
new
(
path_to_repo
)
else
else
raise
CouldNotCreateWikiError
raise
CouldNotCreateWikiError
end
end
end
end
def
init_repo
(
path_with_namespace
)
gitlab_shell
.
add_repository
(
path_with_namespace
)
end
def
commit_details
(
action
,
message
=
nil
,
title
=
nil
)
def
commit_details
(
action
,
message
=
nil
,
title
=
nil
)
commit_message
=
message
||
default_message
(
action
,
title
)
commit_message
=
message
||
default_message
(
action
,
title
)
...
...
lib/gitlab/git/commit.rb
View file @
9a26e9a0
...
@@ -144,6 +144,10 @@ module Gitlab
...
@@ -144,6 +144,10 @@ module Gitlab
rescue
rescue
true
true
end
end
def
no_commit_message
"--no commit message"
end
end
end
end
end
end
end
spec/factories.rb
View file @
9a26e9a0
...
@@ -86,9 +86,9 @@ FactoryGirl.define do
...
@@ -86,9 +86,9 @@ FactoryGirl.define do
target_branch
"master"
# pretend bcf03b5d~3
target_branch
"master"
# pretend bcf03b5d~3
source_branch
"stable"
# pretend bcf03b5d
source_branch
"stable"
# pretend bcf03b5d
st_commits
do
st_commits
do
[
Commit
.
new
(
project
.
repo
.
commit
(
'bcf03b5d'
)),
[
Commit
.
new
(
project
.
repo
sitory
.
commit
(
'bcf03b5d'
)),
Commit
.
new
(
project
.
repo
.
commit
(
'bcf03b5d~1'
)),
Commit
.
new
(
project
.
repo
sitory
.
commit
(
'bcf03b5d~1'
)),
Commit
.
new
(
project
.
repo
.
commit
(
'bcf03b5d~2'
))]
Commit
.
new
(
project
.
repo
sitory
.
commit
(
'bcf03b5d~2'
))]
end
end
st_diffs
do
st_diffs
do
project
.
repo
.
diff
(
"bcf03b5d~3"
,
"bcf03b5d"
)
project
.
repo
.
diff
(
"bcf03b5d~3"
,
"bcf03b5d"
)
...
@@ -120,6 +120,7 @@ FactoryGirl.define do
...
@@ -120,6 +120,7 @@ FactoryGirl.define do
factory
:note_on_merge_request_diff
,
traits:
[
:on_merge_request
,
:on_diff
]
factory
:note_on_merge_request_diff
,
traits:
[
:on_merge_request
,
:on_diff
]
trait
:on_commit
do
trait
:on_commit
do
project
factory: :project_with_code
commit_id
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
commit_id
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
noteable_type
"Commit"
noteable_type
"Commit"
end
end
...
@@ -129,6 +130,7 @@ FactoryGirl.define do
...
@@ -129,6 +130,7 @@ FactoryGirl.define do
end
end
trait
:on_merge_request
do
trait
:on_merge_request
do
project
factory: :project_with_code
noteable_id
1
noteable_id
1
noteable_type
"MergeRequest"
noteable_type
"MergeRequest"
end
end
...
...
spec/models/commit_spec.rb
View file @
9a26e9a0
require
'spec_helper'
require
'spec_helper'
describe
Commit
do
describe
Commit
do
let
(
:commit
)
{
create
(
:project
).
repository
.
commit
}
let
(
:commit
)
{
create
(
:project
_with_code
).
repository
.
commit
}
describe
'#title'
do
describe
'#title'
do
...
...
spec/models/gollum_wiki_spec.rb
View file @
9a26e9a0
...
@@ -81,7 +81,7 @@ describe GollumWiki do
...
@@ -81,7 +81,7 @@ describe GollumWiki do
end
end
it
"raises CouldNotCreateWikiError if it can't create the wiki repository"
do
it
"raises CouldNotCreateWikiError if it can't create the wiki repository"
do
G
itlab
::
Shell
.
any_instance
.
stub
(
:add_repository
).
and_return
(
false
)
G
ollumWiki
.
any_instance
.
stub
(
:init_repo
).
and_return
(
false
)
expect
{
GollumWiki
.
new
(
project
,
user
).
wiki
}.
to
raise_exception
(
GollumWiki
::
CouldNotCreateWikiError
)
expect
{
GollumWiki
.
new
(
project
,
user
).
wiki
}.
to
raise_exception
(
GollumWiki
::
CouldNotCreateWikiError
)
end
end
end
end
...
...
spec/support/test_env.rb
View file @
9a26e9a0
...
@@ -17,11 +17,12 @@ module TestEnv
...
@@ -17,11 +17,12 @@ module TestEnv
repos_path
=
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
)
repos_path
=
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
)
Gitlab
.
config
.
gitlab_shell
.
stub
(
repos_path:
repos_path
)
Gitlab
.
config
.
gitlab_shell
.
stub
(
repos_path:
repos_path
)
G
itlab
::
Shell
.
any_instance
.
stub
(
:add_repository
)
do
|
path
|
G
ollumWiki
.
any_instance
.
stub
(
:init_repo
)
do
|
path
|
create_temp_repo
(
File
.
join
(
repos_path
,
"
#{
path
}
.git"
))
create_temp_repo
(
File
.
join
(
repos_path
,
"
#{
path
}
.git"
))
end
end
Gitlab
::
Shell
.
any_instance
.
stub
(
Gitlab
::
Shell
.
any_instance
.
stub
(
add_repository:
true
,
mv_repository:
true
,
mv_repository:
true
,
remove_repository:
true
,
remove_repository:
true
,
add_key:
true
,
add_key:
true
,
...
...
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