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
150fc0cc
Commit
150fc0cc
authored
Nov 06, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into mentioned_inside_mr
parents
6d775dda
b33d4bc2
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
67 additions
and
54 deletions
+67
-54
app/controllers/projects/base_tree_controller.rb
app/controllers/projects/base_tree_controller.rb
+0
-1
app/controllers/projects/blame_controller.rb
app/controllers/projects/blame_controller.rb
+0
-1
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+0
-1
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+0
-1
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+0
-1
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+0
-1
app/controllers/projects/compare_controller.rb
app/controllers/projects/compare_controller.rb
+0
-1
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+0
-1
app/controllers/projects/network_controller.rb
app/controllers/projects/network_controller.rb
+0
-1
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+0
-1
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+0
-1
app/controllers/projects/repositories_controller.rb
app/controllers/projects/repositories_controller.rb
+0
-1
app/controllers/projects/tags_controller.rb
app/controllers/projects/tags_controller.rb
+0
-2
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+0
-3
app/models/event.rb
app/models/event.rb
+0
-4
app/models/project_services/flowdock_service.rb
app/models/project_services/flowdock_service.rb
+1
-2
app/models/project_services/gemnasium_service.rb
app/models/project_services/gemnasium_service.rb
+1
-2
app/models/project_services/gitlab_ci_service.rb
app/models/project_services/gitlab_ci_service.rb
+2
-2
app/services/git_push_service.rb
app/services/git_push_service.rb
+3
-3
app/services/system_hooks_service.rb
app/services/system_hooks_service.rb
+1
-1
app/uploaders/attachment_uploader.rb
app/uploaders/attachment_uploader.rb
+4
-0
app/views/notify/new_ssh_key_email.html.haml
app/views/notify/new_ssh_key_email.html.haml
+1
-1
app/views/notify/new_ssh_key_email.text.erb
app/views/notify/new_ssh_key_email.text.erb
+2
-2
app/views/projects/blob/_actions.html.haml
app/views/projects/blob/_actions.html.haml
+2
-1
doc/install/installation.md
doc/install/installation.md
+1
-1
features/steps/dashboard/event_filters.rb
features/steps/dashboard/event_filters.rb
+1
-1
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+1
-1
features/steps/shared/project.rb
features/steps/shared/project.rb
+1
-1
lib/backup/repository.rb
lib/backup/repository.rb
+1
-1
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+1
-2
spec/models/gitlab_ci_service_spec.rb
spec/models/gitlab_ci_service_spec.rb
+2
-2
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+1
-2
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+1
-1
spec/support/test_env.rb
spec/support/test_env.rb
+39
-6
No files found.
app/controllers/projects/base_tree_controller.rb
View file @
150fc0cc
class
Projects::BaseTreeController
<
Projects
::
ApplicationController
class
Projects::BaseTreeController
<
Projects
::
ApplicationController
include
ExtractsPath
include
ExtractsPath
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
end
end
...
...
app/controllers/projects/blame_controller.rb
View file @
150fc0cc
...
@@ -3,7 +3,6 @@ class Projects::BlameController < Projects::ApplicationController
...
@@ -3,7 +3,6 @@ class Projects::BlameController < Projects::ApplicationController
include
ExtractsPath
include
ExtractsPath
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/blob_controller.rb
View file @
150fc0cc
...
@@ -3,7 +3,6 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -3,7 +3,6 @@ class Projects::BlobController < Projects::ApplicationController
include
ExtractsPath
include
ExtractsPath
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
before_filter
:authorize_push_code!
,
only:
[
:destroy
]
before_filter
:authorize_push_code!
,
only:
[
:destroy
]
...
...
app/controllers/projects/branches_controller.rb
View file @
150fc0cc
class
Projects::BranchesController
<
Projects
::
ApplicationController
class
Projects::BranchesController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
...
...
app/controllers/projects/commit_controller.rb
View file @
150fc0cc
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
# Not to be confused with CommitsController, plural.
# Not to be confused with CommitsController, plural.
class
Projects::CommitController
<
Projects
::
ApplicationController
class
Projects::CommitController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
before_filter
:commit
before_filter
:commit
...
...
app/controllers/projects/commits_controller.rb
View file @
150fc0cc
...
@@ -4,7 +4,6 @@ class Projects::CommitsController < Projects::ApplicationController
...
@@ -4,7 +4,6 @@ class Projects::CommitsController < Projects::ApplicationController
include
ExtractsPath
include
ExtractsPath
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/compare_controller.rb
View file @
150fc0cc
class
Projects::CompareController
<
Projects
::
ApplicationController
class
Projects::CompareController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/graphs_controller.rb
View file @
150fc0cc
class
Projects::GraphsController
<
Projects
::
ApplicationController
class
Projects::GraphsController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/network_controller.rb
View file @
150fc0cc
...
@@ -3,7 +3,6 @@ class Projects::NetworkController < Projects::ApplicationController
...
@@ -3,7 +3,6 @@ class Projects::NetworkController < Projects::ApplicationController
include
ApplicationHelper
include
ApplicationHelper
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/raw_controller.rb
View file @
150fc0cc
...
@@ -3,7 +3,6 @@ class Projects::RawController < Projects::ApplicationController
...
@@ -3,7 +3,6 @@ class Projects::RawController < Projects::ApplicationController
include
ExtractsPath
include
ExtractsPath
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/refs_controller.rb
View file @
150fc0cc
...
@@ -2,7 +2,6 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -2,7 +2,6 @@ class Projects::RefsController < Projects::ApplicationController
include
ExtractsPath
include
ExtractsPath
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/repositories_controller.rb
View file @
150fc0cc
class
Projects::RepositoriesController
<
Projects
::
ApplicationController
class
Projects::RepositoriesController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
...
...
app/controllers/projects/tags_controller.rb
View file @
150fc0cc
class
Projects::TagsController
<
Projects
::
ApplicationController
class
Projects::TagsController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_project!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
before_filter
:authorize_download_code!
before_filter
:authorize_download_code!
before_filter
:authorize_push_code!
,
only:
[
:create
]
before_filter
:authorize_push_code!
,
only:
[
:create
]
before_filter
:authorize_admin_project!
,
only:
[
:destroy
]
before_filter
:authorize_admin_project!
,
only:
[
:destroy
]
...
...
app/controllers/projects_controller.rb
View file @
150fc0cc
...
@@ -4,7 +4,6 @@ class ProjectsController < ApplicationController
...
@@ -4,7 +4,6 @@ class ProjectsController < ApplicationController
before_filter
:repository
,
except:
[
:new
,
:create
]
before_filter
:repository
,
except:
[
:new
,
:create
]
# Authorize
# Authorize
before_filter
:authorize_read_project!
,
except:
[
:index
,
:new
,
:create
]
before_filter
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:destroy
,
:transfer
,
:archive
,
:unarchive
,
:retry_import
]
before_filter
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:destroy
,
:transfer
,
:archive
,
:unarchive
,
:retry_import
]
layout
'navless'
,
only:
[
:new
,
:create
,
:fork
]
layout
'navless'
,
only:
[
:new
,
:create
,
:fork
]
...
@@ -52,8 +51,6 @@ class ProjectsController < ApplicationController
...
@@ -52,8 +51,6 @@ class ProjectsController < ApplicationController
return
return
end
end
return
authenticate_user!
unless
@project
.
public?
||
current_user
limit
=
(
params
[
:limit
]
||
20
).
to_i
limit
=
(
params
[
:limit
]
||
20
).
to_i
@events
=
@project
.
events
.
recent
@events
=
@project
.
events
.
recent
@events
=
event_filter
.
apply_filter
(
@events
)
@events
=
event_filter
.
apply_filter
(
@events
)
...
...
app/models/event.rb
View file @
150fc0cc
...
@@ -186,10 +186,6 @@ class Event < ActiveRecord::Base
...
@@ -186,10 +186,6 @@ class Event < ActiveRecord::Base
data
[
:ref
][
"refs/heads"
]
data
[
:ref
][
"refs/heads"
]
end
end
def
new_branch?
commit_from
=~
/^00000/
end
def
new_ref?
def
new_ref?
commit_from
=~
/^00000/
commit_from
=~
/^00000/
end
end
...
...
app/models/project_services/flowdock_service.rb
View file @
150fc0cc
...
@@ -37,13 +37,12 @@ class FlowdockService < Service
...
@@ -37,13 +37,12 @@ class FlowdockService < Service
end
end
def
execute
(
push_data
)
def
execute
(
push_data
)
repo_path
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
"
#{
project
.
path_with_namespace
}
.git"
)
Flowdock
::
Git
.
post
(
Flowdock
::
Git
.
post
(
push_data
[
:ref
],
push_data
[
:ref
],
push_data
[
:before
],
push_data
[
:before
],
push_data
[
:after
],
push_data
[
:after
],
token:
token
,
token:
token
,
repo:
repo_path
,
repo:
project
.
repository
.
path_to_repo
,
repo_url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
"
,
repo_url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
"
,
commit_url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
/commit/%s"
,
commit_url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
/commit/%s"
,
diff_url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
/compare/%s...%s"
,
diff_url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
/compare/%s...%s"
,
...
...
app/models/project_services/gemnasium_service.rb
View file @
150fc0cc
...
@@ -38,14 +38,13 @@ class GemnasiumService < Service
...
@@ -38,14 +38,13 @@ class GemnasiumService < Service
end
end
def
execute
(
push_data
)
def
execute
(
push_data
)
repo_path
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
"
#{
project
.
path_with_namespace
}
.git"
)
Gemnasium
::
GitlabService
.
execute
(
Gemnasium
::
GitlabService
.
execute
(
ref:
push_data
[
:ref
],
ref:
push_data
[
:ref
],
before:
push_data
[
:before
],
before:
push_data
[
:before
],
after:
push_data
[
:after
],
after:
push_data
[
:after
],
token:
token
,
token:
token
,
api_key:
api_key
,
api_key:
api_key
,
repo:
repo_path
repo:
project
.
repository
.
path_to_repo
)
)
end
end
end
end
app/models/project_services/gitlab_ci_service.rb
View file @
150fc0cc
...
@@ -28,7 +28,7 @@ class GitlabCiService < CiService
...
@@ -28,7 +28,7 @@ class GitlabCiService < CiService
end
end
def
commit_status_path
(
sha
)
def
commit_status_path
(
sha
)
project_url
+
"/
build
s/
#{
sha
}
/status.json?token=
#{
token
}
"
project_url
+
"/
commit
s/
#{
sha
}
/status.json?token=
#{
token
}
"
end
end
def
get_ci_build
(
sha
)
def
get_ci_build
(
sha
)
...
@@ -55,7 +55,7 @@ class GitlabCiService < CiService
...
@@ -55,7 +55,7 @@ class GitlabCiService < CiService
end
end
def
build_page
(
sha
)
def
build_page
(
sha
)
project_url
+
"/
build
s/
#{
sha
}
"
project_url
+
"/
commit
s/
#{
sha
}
"
end
end
def
builds_path
def
builds_path
...
...
app/services/git_push_service.rb
View file @
150fc0cc
...
@@ -160,19 +160,19 @@ class GitPushService
...
@@ -160,19 +160,19 @@ class GitPushService
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
# Return if this is not a push to a branch (e.g. new commits)
# Return if this is not a push to a branch (e.g. new commits)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
!=
"0000000000000000000000000000000000000000"
ref_parts
[
1
]
=~
/heads/
&&
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
end
end
def
push_to_new_branch?
(
ref
,
oldrev
)
def
push_to_new_branch?
(
ref
,
oldrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
==
"0000000000000000000000000000000000000000"
ref_parts
[
1
]
=~
/heads/
&&
oldrev
==
Gitlab
::
Git
::
BLANK_SHA
end
end
def
push_remove_branch?
(
ref
,
newrev
)
def
push_remove_branch?
(
ref
,
newrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
newrev
==
"0000000000000000000000000000000000000000"
ref_parts
[
1
]
=~
/heads/
&&
newrev
==
Gitlab
::
Git
::
BLANK_SHA
end
end
def
push_to_branch?
(
ref
)
def
push_to_branch?
(
ref
)
...
...
app/services/system_hooks_service.rb
View file @
150fc0cc
...
@@ -18,7 +18,7 @@ class SystemHooksService
...
@@ -18,7 +18,7 @@ class SystemHooksService
def
build_event_data
(
model
,
event
)
def
build_event_data
(
model
,
event
)
data
=
{
data
=
{
event_name:
build_event_name
(
model
,
event
),
event_name:
build_event_name
(
model
,
event
),
created_at:
model
.
created_at
created_at:
model
.
created_at
.
xmlschema
}
}
case
model
case
model
...
...
app/uploaders/attachment_uploader.rb
View file @
150fc0cc
...
@@ -26,6 +26,10 @@ class AttachmentUploader < CarrierWave::Uploader::Base
...
@@ -26,6 +26,10 @@ class AttachmentUploader < CarrierWave::Uploader::Base
Gitlab
.
config
.
gitlab
.
relative_url_root
+
"/files/
#{
model
.
class
.
to_s
.
underscore
}
/
#{
model
.
id
}
/
#{
file
.
filename
}
"
Gitlab
.
config
.
gitlab
.
relative_url_root
+
"/files/
#{
model
.
class
.
to_s
.
underscore
}
/
#{
model
.
id
}
/
#{
file
.
filename
}
"
end
end
def
url
Gitlab
.
config
.
gitlab
.
relative_url_root
+
super
unless
super
.
nil?
end
def
file_storage?
def
file_storage?
self
.
class
.
storage
==
CarrierWave
::
Storage
::
File
self
.
class
.
storage
==
CarrierWave
::
Storage
::
File
end
end
...
...
app/views/notify/new_ssh_key_email.html.haml
View file @
150fc0cc
...
@@ -6,5 +6,5 @@
...
@@ -6,5 +6,5 @@
title:
title:
%code
=
@key
.
title
%code
=
@key
.
title
%p
%p
If this key was added in error, you can remove it
here:
If this key was added in error, you can remove it
under
=
link_to
"SSH Keys"
,
profile_keys_url
=
link_to
"SSH Keys"
,
profile_keys_url
app/views/notify/new_ssh_key_email.text.erb
View file @
150fc0cc
...
@@ -2,6 +2,6 @@ Hi <%= @user.name %>!
...
@@ -2,6 +2,6 @@ Hi <%= @user.name %>!
A new public key was added to your account:
A new public key was added to your account:
title..................
<%=
@key
.
title
%>
Title:
<%=
@key
.
title
%>
If this key was added in error, you can remove it
here:
<%=
profile_keys_url
%>
If this key was added in error, you can remove it
at
<%=
profile_keys_url
%>
app/views/projects/blob/_actions.html.haml
View file @
150fc0cc
...
@@ -23,5 +23,6 @@
...
@@ -23,5 +23,6 @@
tree_join
(
@commit
.
sha
,
@path
)),
class:
'btn btn-small'
tree_join
(
@commit
.
sha
,
@path
)),
class:
'btn btn-small'
-
if
allowed_tree_edit?
-
if
allowed_tree_edit?
=
link_to
'#modal-remove-blob'
,
class:
"remove-blob btn btn-small btn-remove"
,
"data-toggle"
=>
"modal"
do
=
button_tag
class:
'remove-blob btn btn-small btn-remove'
,
'data-toggle'
=>
'modal'
,
'data-target'
=>
'#modal-remove-blob'
do
Remove
Remove
doc/install/installation.md
View file @
150fc0cc
...
@@ -199,7 +199,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
...
@@ -199,7 +199,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
# Make sure GitLab can write to the log/ and tmp/ directories
# Make sure GitLab can write to the log/ and tmp/ directories
sudo chown -R git log/
sudo chown -R git log/
sudo chown -R git tmp/
sudo chown -R git tmp/
sudo chmod -R u+rwX log/
sudo chmod -R u+rwX
,go-w
log/
sudo chmod -R u+rwX tmp/
sudo chmod -R u+rwX tmp/
# Create directory for satellites
# Create directory for satellites
...
...
features/steps/dashboard/event_filters.rb
View file @
150fc0cc
...
@@ -29,7 +29,7 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps
...
@@ -29,7 +29,7 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps
step
'this project has push event'
do
step
'this project has push event'
do
data
=
{
data
=
{
before:
"0000000000000000000000000000000000000000"
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
after:
"0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e"
,
after:
"0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e"
,
ref:
"refs/heads/new_design"
,
ref:
"refs/heads/new_design"
,
user_id:
@user
.
id
,
user_id:
@user
.
id
,
...
...
features/steps/project/source/browse_files.rb
View file @
150fc0cc
...
@@ -78,7 +78,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -78,7 +78,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
end
step
'I click on "Remove"'
do
step
'I click on "Remove"'
do
click_
link
'Remove'
click_
button
'Remove'
end
end
step
'I click on "Remove file"'
do
step
'I click on "Remove file"'
do
...
...
features/steps/shared/project.rb
View file @
150fc0cc
...
@@ -32,7 +32,7 @@ module SharedProject
...
@@ -32,7 +32,7 @@ module SharedProject
@project
=
Project
.
find_by
(
name:
"Shop"
)
@project
=
Project
.
find_by
(
name:
"Shop"
)
data
=
{
data
=
{
before:
"0000000000000000000000000000000000000000"
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
after:
"6d394385cf567f80a8fd85055db1ab4c5295806f"
,
after:
"6d394385cf567f80a8fd85055db1ab4c5295806f"
,
ref:
"refs/heads/fix"
,
ref:
"refs/heads/fix"
,
user_id:
@user
.
id
,
user_id:
@user
.
id
,
...
...
lib/backup/repository.rb
View file @
150fc0cc
...
@@ -91,7 +91,7 @@ module Backup
...
@@ -91,7 +91,7 @@ module Backup
protected
protected
def
path_to_repo
(
project
)
def
path_to_repo
(
project
)
File
.
join
(
repos_path
,
project
.
path_with_namespace
+
'.git'
)
project
.
repository
.
path_to_repo
end
end
def
path_to_bundle
(
project
)
def
path_to_bundle
(
project
)
...
...
lib/tasks/gitlab/shell.rake
View file @
150fc0cc
...
@@ -76,7 +76,7 @@ namespace :gitlab do
...
@@ -76,7 +76,7 @@ namespace :gitlab do
desc
"GITLAB | Build missing projects"
desc
"GITLAB | Build missing projects"
task
build_missing_projects: :environment
do
task
build_missing_projects: :environment
do
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
path_to_repo
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
"
#{
project
.
path_with_namespace
}
.git"
)
path_to_repo
=
project
.
repository
.
path_to_repo
if
File
.
exists?
(
path_to_repo
)
if
File
.
exists?
(
path_to_repo
)
print
'-'
print
'-'
else
else
...
...
spec/models/event_spec.rb
View file @
150fc0cc
...
@@ -36,7 +36,7 @@ describe Event do
...
@@ -36,7 +36,7 @@ describe Event do
@user
=
project
.
owner
@user
=
project
.
owner
data
=
{
data
=
{
before:
"0000000000000000000000000000000000000000"
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
after:
"0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e"
,
after:
"0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e"
,
ref:
"refs/heads/master"
,
ref:
"refs/heads/master"
,
user_id:
@user
.
id
,
user_id:
@user
.
id
,
...
@@ -60,7 +60,6 @@ describe Event do
...
@@ -60,7 +60,6 @@ describe Event do
it
{
@event
.
push?
.
should
be_true
}
it
{
@event
.
push?
.
should
be_true
}
it
{
@event
.
proper?
.
should
be_true
}
it
{
@event
.
proper?
.
should
be_true
}
it
{
@event
.
new_branch?
.
should
be_true
}
it
{
@event
.
tag?
.
should
be_false
}
it
{
@event
.
tag?
.
should
be_false
}
it
{
@event
.
branch_name
.
should
==
"master"
}
it
{
@event
.
branch_name
.
should
==
"master"
}
it
{
@event
.
author
.
should
==
@user
}
it
{
@event
.
author
.
should
==
@user
}
...
...
spec/models/gitlab_ci_service_spec.rb
View file @
150fc0cc
...
@@ -34,11 +34,11 @@ describe GitlabCiService do
...
@@ -34,11 +34,11 @@ describe GitlabCiService do
end
end
describe
:commit_status_path
do
describe
:commit_status_path
do
it
{
@service
.
commit_status_path
(
"2ab7834c"
).
should
==
"http://ci.gitlab.org/projects/2/
build
s/2ab7834c/status.json?token=verySecret"
}
it
{
@service
.
commit_status_path
(
"2ab7834c"
).
should
==
"http://ci.gitlab.org/projects/2/
commit
s/2ab7834c/status.json?token=verySecret"
}
end
end
describe
:build_page
do
describe
:build_page
do
it
{
@service
.
build_page
(
"2ab7834c"
).
should
==
"http://ci.gitlab.org/projects/2/
build
s/2ab7834c"
}
it
{
@service
.
build_page
(
"2ab7834c"
).
should
==
"http://ci.gitlab.org/projects/2/
commit
s/2ab7834c"
}
end
end
end
end
end
end
spec/requests/api/repositories_spec.rb
View file @
150fc0cc
...
@@ -37,8 +37,7 @@ describe API::API, api: true do
...
@@ -37,8 +37,7 @@ describe API::API, api: true do
context
'annotated tag'
do
context
'annotated tag'
do
it
'should create a new annotated tag'
do
it
'should create a new annotated tag'
do
# Identity must be set in .gitconfig to create annotated tag.
# Identity must be set in .gitconfig to create annotated tag.
repo_path
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
repo_path
=
project
.
repository
.
path_to_repo
project
.
path_with_namespace
+
'.git'
)
system
(
*
%W(git --git-dir=
#{
repo_path
}
config user.name
#{
user
.
name
}
)
)
system
(
*
%W(git --git-dir=
#{
repo_path
}
config user.name
#{
user
.
name
}
)
)
system
(
*
%W(git --git-dir=
#{
repo_path
}
config user.email
#{
user
.
email
}
)
)
system
(
*
%W(git --git-dir=
#{
repo_path
}
config user.email
#{
user
.
email
}
)
)
...
...
spec/services/git_push_service_spec.rb
View file @
150fc0cc
...
@@ -8,7 +8,7 @@ describe GitPushService do
...
@@ -8,7 +8,7 @@ describe GitPushService do
let
(
:service
)
{
GitPushService
.
new
}
let
(
:service
)
{
GitPushService
.
new
}
before
do
before
do
@blankrev
=
'0000000000000000000000000000000000000000'
@blankrev
=
Gitlab
::
Git
::
BLANK_SHA
@oldrev
=
sample_commit
.
parent_id
@oldrev
=
sample_commit
.
parent_id
@newrev
=
sample_commit
.
id
@newrev
=
sample_commit
.
id
@ref
=
'refs/heads/master'
@ref
=
'refs/heads/master'
...
...
spec/support/test_env.rb
View file @
150fc0cc
...
@@ -3,6 +3,16 @@ require 'rspec/mocks'
...
@@ -3,6 +3,16 @@ require 'rspec/mocks'
module
TestEnv
module
TestEnv
extend
self
extend
self
# When developing the seed repository, comment out the branch you will modify.
BRANCH_SHA
=
{
'feature'
=>
'0b4bc9a'
,
'feature_conflict'
=>
'bb5206f'
,
'fix'
=>
'12d65c8'
,
'improve/awesome'
=>
'5937ac0'
,
'markdown'
=>
'0ed8c6c'
,
'master'
=>
'5937ac0'
}
# Test environment
# Test environment
#
#
# See gitlab.yml.example test section for paths
# See gitlab.yml.example test section for paths
...
@@ -18,13 +28,13 @@ module TestEnv
...
@@ -18,13 +28,13 @@ module TestEnv
if
File
.
directory?
(
tmp_test_path
)
if
File
.
directory?
(
tmp_test_path
)
Dir
.
entries
(
tmp_test_path
).
each
do
|
entry
|
Dir
.
entries
(
tmp_test_path
).
each
do
|
entry
|
unless
[
'.'
,
'..'
,
'gitlab-shell'
].
include?
(
entry
)
unless
[
'.'
,
'..'
,
'gitlab-shell'
,
factory_repo_name
].
include?
(
entry
)
FileUtils
.
rm_r
(
File
.
join
(
tmp_test_path
,
entry
))
FileUtils
.
rm_r
(
File
.
join
(
tmp_test_path
,
entry
))
end
end
end
end
end
end
FileUtils
.
mkdir_p
(
tmp_test
_path
)
FileUtils
.
mkdir_p
(
repos
_path
)
# Setup GitLab shell for test instance
# Setup GitLab shell for test instance
setup_gitlab_shell
setup_gitlab_shell
...
@@ -49,13 +59,32 @@ module TestEnv
...
@@ -49,13 +59,32 @@ module TestEnv
clone_url
=
"https://gitlab.com/gitlab-org/
#{
factory_repo_name
}
.git"
clone_url
=
"https://gitlab.com/gitlab-org/
#{
factory_repo_name
}
.git"
unless
File
.
directory?
(
factory_repo_path
)
unless
File
.
directory?
(
factory_repo_path
)
git_cmd
=
%W(git clone --bare
#{
clone_url
}
#{
factory_repo_path
}
)
system
(
*
%W(git clone
#{
clone_url
}
#{
factory_repo_path
}
)
)
system
(
*
git_cmd
)
end
Dir
.
chdir
(
factory_repo_path
)
do
BRANCH_SHA
.
each
do
|
branch
,
sha
|
# Try to reset without fetching to avoid using the network.
reset
=
%W(git update-ref refs/heads/
#{
branch
}
#{
sha
}
)
unless
system
(
*
reset
)
if
system
(
*
%w(git fetch origin)
)
unless
system
(
*
reset
)
raise
'The fetched test seed '
\
'does not contain the required revision.'
end
else
raise
'Could not fetch test seed repository.'
end
end
end
end
end
# We must copy bare repositories because we will push to them.
system
(
*
%W(git clone --bare
#{
factory_repo_path
}
#{
factory_repo_path_bare
}
)
)
end
end
def
copy_repo
(
project
)
def
copy_repo
(
project
)
base_repo_path
=
File
.
expand_path
(
factory_repo_path
)
base_repo_path
=
File
.
expand_path
(
factory_repo_path
_bare
)
target_repo_path
=
File
.
expand_path
(
repos_path
+
"/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
.git"
)
target_repo_path
=
File
.
expand_path
(
repos_path
+
"/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
.git"
)
FileUtils
.
mkdir_p
(
target_repo_path
)
FileUtils
.
mkdir_p
(
target_repo_path
)
FileUtils
.
cp_r
(
"
#{
base_repo_path
}
/."
,
target_repo_path
)
FileUtils
.
cp_r
(
"
#{
base_repo_path
}
/."
,
target_repo_path
)
...
@@ -69,7 +98,11 @@ module TestEnv
...
@@ -69,7 +98,11 @@ module TestEnv
private
private
def
factory_repo_path
def
factory_repo_path
@factory_repo_path
||=
repos_path
+
"/root/
#{
factory_repo_name
}
.git"
@factory_repo_path
||=
Rails
.
root
.
join
(
'tmp'
,
'tests'
,
factory_repo_name
)
end
def
factory_repo_path_bare
factory_repo_path
.
to_s
+
'_bare'
end
end
def
factory_repo_name
def
factory_repo_name
...
...
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