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
faa2e2df
Commit
faa2e2df
authored
Feb 15, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename commit_file, commit_dir and remove_file and update specs
parent
0625af3b
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
86 additions
and
102 deletions
+86
-102
app/models/repository.rb
app/models/repository.rb
+6
-8
app/services/files/create_dir_service.rb
app/services/files/create_dir_service.rb
+1
-1
app/services/files/create_service.rb
app/services/files/create_service.rb
+1
-2
app/services/files/destroy_service.rb
app/services/files/destroy_service.rb
+1
-1
db/fixtures/development/17_cycle_analytics.rb
db/fixtures/development/17_cycle_analytics.rb
+1
-1
spec/controllers/projects/templates_controller_spec.rb
spec/controllers/projects/templates_controller_spec.rb
+2
-2
spec/factories/projects.rb
spec/factories/projects.rb
+6
-9
spec/features/projects/files/project_owner_creates_license_file_spec.rb
...projects/files/project_owner_creates_license_file_spec.rb
+1
-1
spec/features/projects/issuable_templates_spec.rb
spec/features/projects/issuable_templates_spec.rb
+10
-15
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+2
-3
spec/models/cycle_analytics/production_spec.rb
spec/models/cycle_analytics/production_spec.rb
+2
-3
spec/models/cycle_analytics/staging_spec.rb
spec/models/cycle_analytics/staging_spec.rb
+2
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+45
-45
spec/services/merge_requests/resolve_service_spec.rb
spec/services/merge_requests/resolve_service_spec.rb
+2
-3
spec/support/cycle_analytics_helpers.rb
spec/support/cycle_analytics_helpers.rb
+3
-4
No files found.
app/models/repository.rb
View file @
faa2e2df
...
...
@@ -747,7 +747,7 @@ class Repository
end
# rubocop:disable Metrics/ParameterLists
def
c
ommit
_dir
(
def
c
reate
_dir
(
user
,
path
,
message
:,
branch_name
:,
author_email:
nil
,
author_name:
nil
,
...
...
@@ -778,14 +778,12 @@ class Repository
# rubocop:enable Metrics/ParameterLists
# rubocop:disable Metrics/ParameterLists
def
c
ommit
_file
(
def
c
reate
_file
(
user
,
path
,
content
,
message
:,
branch_name
:,
update:
true
,
message
:,
branch_name
:,
author_email:
nil
,
author_name:
nil
,
start_branch_name:
nil
,
start_project:
project
)
action
=
update
?
:update
:
:create
multi_action
(
user:
user
,
message:
message
,
...
...
@@ -794,7 +792,7 @@ class Repository
author_name:
author_name
,
start_branch_name:
start_branch_name
,
start_project:
start_project
,
actions:
[{
action:
action
,
actions:
[{
action:
:create
,
file_path:
path
,
content:
content
}])
end
...
...
@@ -803,7 +801,7 @@ class Repository
# rubocop:disable Metrics/ParameterLists
def
update_file
(
user
,
path
,
content
,
message
:,
branch_name
:,
previous_path
:,
message
:,
branch_name
:,
previous_path:
nil
,
author_email:
nil
,
author_name:
nil
,
start_branch_name:
nil
,
start_project:
project
)
action
=
if
previous_path
&&
previous_path
!=
path
...
...
@@ -828,7 +826,7 @@ class Repository
# rubocop:enable Metrics/ParameterLists
# rubocop:disable Metrics/ParameterLists
def
remov
e_file
(
def
delet
e_file
(
user
,
path
,
message
:,
branch_name
:,
author_email:
nil
,
author_name:
nil
,
...
...
app/services/files/create_dir_service.rb
View file @
faa2e2df
module
Files
class
CreateDirService
<
Files
::
BaseService
def
commit
repository
.
c
ommit
_dir
(
repository
.
c
reate
_dir
(
current_user
,
@file_path
,
message:
@commit_message
,
...
...
app/services/files/create_service.rb
View file @
faa2e2df
module
Files
class
CreateService
<
Files
::
BaseService
def
commit
repository
.
c
ommit
_file
(
repository
.
c
reate
_file
(
current_user
,
@file_path
,
@file_content
,
message:
@commit_message
,
branch_name:
@target_branch
,
update:
false
,
author_email:
@author_email
,
author_name:
@author_name
,
start_project:
@start_project
,
...
...
app/services/files/destroy_service.rb
View file @
faa2e2df
module
Files
class
DestroyService
<
Files
::
BaseService
def
commit
repository
.
remov
e_file
(
repository
.
delet
e_file
(
current_user
,
@file_path
,
message:
@commit_message
,
...
...
db/fixtures/development/17_cycle_analytics.rb
View file @
faa2e2df
...
...
@@ -155,7 +155,7 @@ class Gitlab::Seeder::CycleAnalytics
issue
.
project
.
repository
.
add_branch
(
@user
,
branch_name
,
'master'
)
commit_sha
=
issue
.
project
.
repository
.
c
ommit
_file
(
@user
,
filename
,
"content"
,
options
,
message:
"Commit for #
#{
issue
.
iid
}
"
,
branch_name:
branch_name
)
commit_sha
=
issue
.
project
.
repository
.
c
reate
_file
(
@user
,
filename
,
"content"
,
options
,
message:
"Commit for #
#{
issue
.
iid
}
"
,
branch_name:
branch_name
)
issue
.
project
.
repository
.
commit
(
commit_sha
)
GitPushService
.
new
(
issue
.
project
,
...
...
spec/controllers/projects/templates_controller_spec.rb
View file @
faa2e2df
...
...
@@ -14,8 +14,8 @@ describe Projects::TemplatesController do
before
do
project
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
project
.
repository
.
c
ommit
_file
(
user
,
file_path_1
,
'something valid'
,
message:
'test 3'
,
branch_name:
'master'
,
update:
false
)
project
.
repository
.
c
reate
_file
(
user
,
file_path_1
,
'something valid'
,
message:
'test 3'
,
branch_name:
'master'
)
end
describe
'#show'
do
...
...
spec/factories/projects.rb
View file @
faa2e2df
...
...
@@ -138,27 +138,24 @@ FactoryGirl.define do
project
.
add_user
(
args
[
:user
],
args
[
:access
])
project
.
repository
.
c
ommit
_file
(
project
.
repository
.
c
reate
_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/bug.md"
,
'something valid'
,
message:
'test 3'
,
branch_name:
'master'
,
update:
false
)
project
.
repository
.
commit_file
(
branch_name:
'master'
)
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/template_test.md"
,
'template_test'
,
message:
'test 1'
,
branch_name:
'master'
,
update:
false
)
project
.
repository
.
commit_file
(
branch_name:
'master'
)
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/feature_proposal.md"
,
'feature_proposal'
,
message:
'test 2'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
end
end
end
...
...
spec/features/projects/files/project_owner_creates_license_file_spec.rb
View file @
faa2e2df
...
...
@@ -6,7 +6,7 @@ feature 'project owner creates a license file', feature: true, js: true do
let
(
:project_master
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
background
do
project
.
repository
.
remov
e_file
(
project_master
,
'LICENSE'
,
project
.
repository
.
delet
e_file
(
project_master
,
'LICENSE'
,
message:
'Remove LICENSE'
,
branch_name:
'master'
)
project
.
team
<<
[
project_master
,
:master
]
login_as
(
project_master
)
...
...
spec/features/projects/issuable_templates_spec.rb
View file @
faa2e2df
...
...
@@ -18,20 +18,18 @@ feature 'issuable templates', feature: true, js: true do
let
(
:description_addition
)
{
' appending to description'
}
background
do
project
.
repository
.
c
ommit
_file
(
project
.
repository
.
c
reate
_file
(
user
,
'.gitlab/issue_templates/bug.md'
,
template_content
,
message:
'added issue template'
,
branch_name:
'master'
,
update:
false
)
project
.
repository
.
commit_file
(
branch_name:
'master'
)
project
.
repository
.
create_file
(
user
,
'.gitlab/issue_templates/test.md'
,
longtemplate_content
,
message:
'added issue template'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
visit
edit_namespace_project_issue_path
project
.
namespace
,
project
,
issue
fill_in
:'issue[title]'
,
with:
'test issue title'
end
...
...
@@ -79,13 +77,12 @@ feature 'issuable templates', feature: true, js: true do
let
(
:issue
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project
)
}
background
do
project
.
repository
.
c
ommit
_file
(
project
.
repository
.
c
reate
_file
(
user
,
'.gitlab/issue_templates/bug.md'
,
template_content
,
message:
'added issue template'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
visit
edit_namespace_project_issue_path
project
.
namespace
,
project
,
issue
fill_in
:'issue[title]'
,
with:
'test issue title'
fill_in
:'issue[description]'
,
with:
prior_description
...
...
@@ -104,13 +101,12 @@ feature 'issuable templates', feature: true, js: true do
let
(
:merge_request
)
{
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
}
background
do
project
.
repository
.
c
ommit
_file
(
project
.
repository
.
c
reate
_file
(
user
,
'.gitlab/merge_request_templates/feature-proposal.md'
,
template_content
,
message:
'added merge request template'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
visit
edit_namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
fill_in
:'merge_request[title]'
,
with:
'test merge request title'
end
...
...
@@ -135,13 +131,12 @@ feature 'issuable templates', feature: true, js: true do
fork_project
.
team
<<
[
fork_user
,
:master
]
create
(
:forked_project_link
,
forked_to_project:
fork_project
,
forked_from_project:
project
)
login_as
fork_user
project
.
repository
.
c
ommit
_file
(
project
.
repository
.
c
reate
_file
(
fork_user
,
'.gitlab/merge_request_templates/feature-proposal.md'
,
template_content
,
message:
'added merge request template'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
visit
edit_namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
fill_in
:'merge_request[title]'
,
with:
'test merge request title'
end
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
faa2e2df
...
...
@@ -209,13 +209,12 @@ describe Gitlab::GitAccess, lib: true do
stub_git_hooks
project
.
repository
.
add_branch
(
user
,
unprotected_branch
,
'feature'
)
target_branch
=
project
.
repository
.
lookup
(
'feature'
)
source_branch
=
project
.
repository
.
c
ommit
_file
(
source_branch
=
project
.
repository
.
c
reate
_file
(
user
,
FFaker
::
InternetSE
.
login_user_name
,
FFaker
::
HipsterIpsum
.
paragraph
,
message:
FFaker
::
HipsterIpsum
.
sentence
,
branch_name:
unprotected_branch
,
update:
false
)
branch_name:
unprotected_branch
)
rugged
=
project
.
repository
.
rugged
author
=
{
email:
"email@example.com"
,
time:
Time
.
now
,
name:
"Example Git User"
}
...
...
spec/models/cycle_analytics/production_spec.rb
View file @
faa2e2df
...
...
@@ -21,13 +21,12 @@ describe 'CycleAnalytics#production', feature: true do
[
"production deploy happens after merge request is merged (along with other changes)"
,
lambda
do
|
context
,
data
|
# Make other changes on master
sha
=
context
.
project
.
repository
.
c
ommit
_file
(
sha
=
context
.
project
.
repository
.
c
reate
_file
(
context
.
user
,
context
.
random_git_name
,
'content'
,
message:
'commit message'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
context
.
project
.
repository
.
commit
(
sha
)
context
.
deploy_master
...
...
spec/models/cycle_analytics/staging_spec.rb
View file @
faa2e2df
...
...
@@ -26,13 +26,12 @@ describe 'CycleAnalytics#staging', feature: true do
[
"production deploy happens after merge request is merged (along with other changes)"
,
lambda
do
|
context
,
data
|
# Make other changes on master
sha
=
context
.
project
.
repository
.
c
ommit
_file
(
sha
=
context
.
project
.
repository
.
c
reate
_file
(
context
.
user
,
context
.
random_git_name
,
'content'
,
message:
'commit message'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
context
.
project
.
repository
.
commit
(
sha
)
context
.
deploy_master
...
...
spec/models/project_spec.rb
View file @
faa2e2df
...
...
@@ -1765,7 +1765,7 @@ describe Project, models: true do
end
before
do
project
.
repository
.
c
ommit_file
(
User
.
last
,
'.gitlab/route-map.yml'
,
route_map
,
message:
'Add .gitlab/route-map.yml'
,
branch_name:
'master'
,
update:
false
)
project
.
repository
.
c
reate_file
(
User
.
last
,
'.gitlab/route-map.yml'
,
route_map
,
message:
'Add .gitlab/route-map.yml'
,
branch_name:
'master'
)
end
context
'when there is a .gitlab/route-map.yml at the commit'
do
...
...
spec/models/repository_spec.rb
View file @
faa2e2df
...
...
@@ -294,7 +294,7 @@ describe Repository, models: true do
describe
"#commit_dir"
do
it
"commits a change that creates a new directory"
do
expect
do
repository
.
c
ommit
_dir
(
user
,
'newdir'
,
repository
.
c
reate
_dir
(
user
,
'newdir'
,
message:
'Create newdir'
,
branch_name:
'master'
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
...
...
@@ -307,7 +307,7 @@ describe Repository, models: true do
it
"creates a fork and commit to the forked project"
do
expect
do
repository
.
c
ommit
_dir
(
user
,
'newdir'
,
repository
.
c
reate
_dir
(
user
,
'newdir'
,
message:
'Create newdir'
,
branch_name:
'patch'
,
start_branch_name:
'master'
,
start_project:
forked_project
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
0
)
...
...
@@ -323,7 +323,7 @@ describe Repository, models: true do
context
"when an author is specified"
do
it
"uses the given email/name to set the commit's author"
do
expect
do
repository
.
c
ommit
_dir
(
user
,
'newdir'
,
repository
.
c
reate
_dir
(
user
,
'newdir'
,
message:
'Add newdir'
,
branch_name:
'master'
,
author_email:
author_email
,
author_name:
author_name
)
...
...
@@ -337,25 +337,23 @@ describe Repository, models: true do
end
end
describe
"#c
ommit
_file"
do
it
'commits
change to a
file successfully'
do
describe
"#c
reate
_file"
do
it
'commits
new
file successfully'
do
expect
do
repository
.
commit_file
(
user
,
'CHANGELOG'
,
'Changelog!'
,
message:
'Updates file content'
,
branch_name:
'master'
,
update:
true
)
repository
.
create_file
(
user
,
'NEWCHANGELOG'
,
'Changelog!'
,
message:
'Create changelog'
,
branch_name:
'master'
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
blob
=
repository
.
blob_at
(
'master'
,
'CHANGELOG'
)
blob
=
repository
.
blob_at
(
'master'
,
'
NEW
CHANGELOG'
)
expect
(
blob
.
data
).
to
eq
(
'Changelog!'
)
end
it
'respects the autocrlf setting'
do
repository
.
c
ommit
_file
(
user
,
'hello.txt'
,
"Hello,
\r\n
World"
,
repository
.
c
reate
_file
(
user
,
'hello.txt'
,
"Hello,
\r\n
World"
,
message:
'Add hello world'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
blob
=
repository
.
blob_at
(
'master'
,
'hello.txt'
)
...
...
@@ -365,10 +363,9 @@ describe Repository, models: true do
context
"when an author is specified"
do
it
"uses the given email/name to set the commit's author"
do
expect
do
repository
.
c
ommit_file
(
user
,
'
README'
,
'README!'
,
repository
.
c
reate_file
(
user
,
'NEW
README'
,
'README!'
,
message:
'Add README'
,
branch_name:
'master'
,
update:
true
,
author_email:
author_email
,
author_name:
author_name
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
...
...
@@ -382,6 +379,18 @@ describe Repository, models: true do
end
describe
"#update_file"
do
it
'updates file successfully'
do
expect
do
repository
.
update_file
(
user
,
'CHANGELOG'
,
'Changelog!'
,
message:
'Update changelog'
,
branch_name:
'master'
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
blob
=
repository
.
blob_at
(
'master'
,
'CHANGELOG'
)
expect
(
blob
.
data
).
to
eq
(
'Changelog!'
)
end
it
'updates filename successfully'
do
expect
do
repository
.
update_file
(
user
,
'NEWLICENSE'
,
'Copyright!'
,
...
...
@@ -398,8 +407,6 @@ describe Repository, models: true do
context
"when an author is specified"
do
it
"uses the given email/name to set the commit's author"
do
repository
.
commit_file
(
user
,
'README'
,
'README!'
,
message:
'Add README'
,
branch_name:
'master'
,
update:
true
)
expect
do
repository
.
update_file
(
user
,
'README'
,
'Updated README!'
,
...
...
@@ -420,11 +427,8 @@ describe Repository, models: true do
describe
"#remove_file"
do
it
'removes file successfully'
do
repository
.
commit_file
(
user
,
'README'
,
'README!'
,
message:
'Add README'
,
branch_name:
'master'
,
update:
true
)
expect
do
repository
.
remov
e_file
(
user
,
'README'
,
repository
.
delet
e_file
(
user
,
'README'
,
message:
'Remove README'
,
branch_name:
'master'
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
...
...
@@ -433,11 +437,8 @@ describe Repository, models: true do
context
"when an author is specified"
do
it
"uses the given email/name to set the commit's author"
do
repository
.
commit_file
(
user
,
'README'
,
'README!'
,
message:
'Add README'
,
branch_name:
'master'
,
update:
true
)
expect
do
repository
.
remov
e_file
(
user
,
'README'
,
repository
.
delet
e_file
(
user
,
'README'
,
message:
'Remove README'
,
branch_name:
'master'
,
author_email:
author_email
,
author_name:
author_name
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
...
...
@@ -587,14 +588,14 @@ describe Repository, models: true do
describe
"#license_blob"
,
caching:
true
do
before
do
repository
.
remov
e_file
(
repository
.
delet
e_file
(
user
,
'LICENSE'
,
message:
'Remove LICENSE'
,
branch_name:
'master'
)
end
it
'handles when HEAD points to non-existent ref'
do
repository
.
c
ommit
_file
(
repository
.
c
reate
_file
(
user
,
'LICENSE'
,
'Copyright!'
,
message:
'Add LICENSE'
,
branch_name:
'master'
,
update:
false
)
message:
'Add LICENSE'
,
branch_name:
'master'
)
allow
(
repository
).
to
receive
(
:file_on_head
).
and_raise
(
Rugged
::
ReferenceError
)
...
...
@@ -603,27 +604,27 @@ describe Repository, models: true do
end
it
'looks in the root_ref only'
do
repository
.
remov
e_file
(
user
,
'LICENSE'
,
repository
.
delet
e_file
(
user
,
'LICENSE'
,
message:
'Remove LICENSE'
,
branch_name:
'markdown'
)
repository
.
c
ommit
_file
(
user
,
'LICENSE'
,
repository
.
c
reate
_file
(
user
,
'LICENSE'
,
Licensee
::
License
.
new
(
'mit'
).
content
,
message:
'Add LICENSE'
,
branch_name:
'markdown'
,
update:
false
)
message:
'Add LICENSE'
,
branch_name:
'markdown'
)
expect
(
repository
.
license_blob
).
to
be_nil
end
it
'detects license file with no recognizable open-source license content'
do
repository
.
c
ommit
_file
(
user
,
'LICENSE'
,
'Copyright!'
,
message:
'Add LICENSE'
,
branch_name:
'master'
,
update:
false
)
repository
.
c
reate
_file
(
user
,
'LICENSE'
,
'Copyright!'
,
message:
'Add LICENSE'
,
branch_name:
'master'
)
expect
(
repository
.
license_blob
.
name
).
to
eq
(
'LICENSE'
)
end
%w[LICENSE LICENCE LiCensE LICENSE.md LICENSE.foo COPYING COPYING.md]
.
each
do
|
filename
|
it
"detects '
#{
filename
}
'"
do
repository
.
c
ommit
_file
(
user
,
filename
,
repository
.
c
reate
_file
(
user
,
filename
,
Licensee
::
License
.
new
(
'mit'
).
content
,
message:
"Add
#{
filename
}
"
,
branch_name:
'master'
,
update:
false
)
message:
"Add
#{
filename
}
"
,
branch_name:
'master'
)
expect
(
repository
.
license_blob
.
name
).
to
eq
(
filename
)
end
...
...
@@ -632,7 +633,7 @@ describe Repository, models: true do
describe
'#license_key'
,
caching:
true
do
before
do
repository
.
remov
e_file
(
user
,
'LICENSE'
,
repository
.
delet
e_file
(
user
,
'LICENSE'
,
message:
'Remove LICENSE'
,
branch_name:
'master'
)
end
...
...
@@ -647,16 +648,16 @@ describe Repository, models: true do
end
it
'detects license file with no recognizable open-source license content'
do
repository
.
c
ommit
_file
(
user
,
'LICENSE'
,
'Copyright!'
,
message:
'Add LICENSE'
,
branch_name:
'master'
,
update:
false
)
repository
.
c
reate
_file
(
user
,
'LICENSE'
,
'Copyright!'
,
message:
'Add LICENSE'
,
branch_name:
'master'
)
expect
(
repository
.
license_key
).
to
be_nil
end
it
'returns the license key'
do
repository
.
c
ommit
_file
(
user
,
'LICENSE'
,
repository
.
c
reate
_file
(
user
,
'LICENSE'
,
Licensee
::
License
.
new
(
'mit'
).
content
,
message:
'Add LICENSE'
,
branch_name:
'master'
,
update:
false
)
message:
'Add LICENSE'
,
branch_name:
'master'
)
expect
(
repository
.
license_key
).
to
eq
(
'mit'
)
end
...
...
@@ -913,10 +914,9 @@ describe Repository, models: true do
expect
(
empty_repository
).
to
receive
(
:expire_emptiness_caches
)
expect
(
empty_repository
).
to
receive
(
:expire_branches_cache
)
empty_repository
.
c
ommit
_file
(
user
,
'CHANGELOG'
,
'Changelog!'
,
empty_repository
.
c
reate
_file
(
user
,
'CHANGELOG'
,
'Changelog!'
,
message:
'Updates file content'
,
branch_name:
'master'
,
update:
false
)
branch_name:
'master'
)
end
end
end
...
...
@@ -1796,7 +1796,7 @@ describe Repository, models: true do
describe
'#gitlab_ci_yml_for'
do
before
do
repository
.
c
ommit_file
(
User
.
last
,
'.gitlab-ci.yml'
,
'CONTENT'
,
message:
'Add .gitlab-ci.yml'
,
branch_name:
'master'
,
update:
false
)
repository
.
c
reate_file
(
User
.
last
,
'.gitlab-ci.yml'
,
'CONTENT'
,
message:
'Add .gitlab-ci.yml'
,
branch_name:
'master'
)
end
context
'when there is a .gitlab-ci.yml at the commit'
do
...
...
@@ -1814,7 +1814,7 @@ describe Repository, models: true do
describe
'#route_map_for'
do
before
do
repository
.
c
ommit_file
(
User
.
last
,
'.gitlab/route-map.yml'
,
'CONTENT'
,
message:
'Add .gitlab/route-map.yml'
,
branch_name:
'master'
,
update:
false
)
repository
.
c
reate_file
(
User
.
last
,
'.gitlab/route-map.yml'
,
'CONTENT'
,
message:
'Add .gitlab/route-map.yml'
,
branch_name:
'master'
)
end
context
'when there is a .gitlab/route-map.yml at the commit'
do
...
...
spec/services/merge_requests/resolve_service_spec.rb
View file @
faa2e2df
...
...
@@ -66,13 +66,12 @@ describe MergeRequests::ResolveService do
context
'when the source project is a fork and does not contain the HEAD of the target branch'
do
let!
(
:target_head
)
do
project
.
repository
.
c
ommit
_file
(
project
.
repository
.
c
reate
_file
(
user
,
'new-file-in-target'
,
''
,
message:
'Add new file in target'
,
branch_name:
'conflict-start'
,
update:
false
)
branch_name:
'conflict-start'
)
end
before
do
...
...
spec/support/cycle_analytics_helpers.rb
View file @
faa2e2df
...
...
@@ -9,7 +9,7 @@ module CycleAnalyticsHelpers
commit_shas
=
Array
.
new
(
count
)
do
|
index
|
filename
=
random_git_name
commit_sha
=
project
.
repository
.
c
ommit
_file
(
user
,
filename
,
"content"
,
message:
message
,
branch_name:
branch_name
)
commit_sha
=
project
.
repository
.
c
reate
_file
(
user
,
filename
,
"content"
,
message:
message
,
branch_name:
branch_name
)
project
.
repository
.
commit
(
commit_sha
)
commit_sha
...
...
@@ -28,13 +28,12 @@ module CycleAnalyticsHelpers
project
.
repository
.
add_branch
(
user
,
source_branch
,
'master'
)
end
sha
=
project
.
repository
.
c
ommit
_file
(
sha
=
project
.
repository
.
c
reate
_file
(
user
,
random_git_name
,
'content'
,
message:
'commit message'
,
branch_name:
source_branch
,
update:
false
)
branch_name:
source_branch
)
project
.
repository
.
commit
(
sha
)
opts
=
{
...
...
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