BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d684b110
Unverified
Commit
d684b110
authored
Jun 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary satellite files and add CHANGELOG item
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
435f680b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
81 deletions
+3
-81
CHANGELOG
CHANGELOG
+1
-0
delete_file_action.rb
lib/gitlab/satellite/files/delete_file_action.rb
+0
-50
file_action.rb
lib/gitlab/satellite/files/file_action.rb
+0
-17
files_spec.rb
spec/requests/api/files_spec.rb
+2
-14
No files found.
CHANGELOG
View file @
d684b110
...
...
@@ -37,6 +37,7 @@ v 7.12.0 (unreleased)
- User has ability to leave project
- Add SAML support as an omniauth provider
- Allow to configure a URL to show after sign out
- Better performance for web editor (switched from satellites to rugged)
v 7.11.4
- Fix missing bullets when creating lists
...
...
lib/gitlab/satellite/files/delete_file_action.rb
deleted
100644 → 0
View file @
435f680b
require_relative
'file_action'
module
Gitlab
module
Satellite
class
DeleteFileAction
<
FileAction
# Deletes file and creates a new commit for it
#
# Returns false if committing the change fails
# Returns false if pushing from the satellite to bare repo failed or was rejected
# Returns true otherwise
def
commit!
(
content
,
commit_message
)
in_locked_and_timed_satellite
do
|
repo
|
prepare_satellite!
(
repo
)
# create target branch in satellite at the corresponding commit from bare repo
repo
.
git
.
checkout
({
raise:
true
,
timeout:
true
,
b:
true
},
ref
,
"origin/
#{
ref
}
"
)
# update the file in the satellite's working dir
file_path_in_satellite
=
File
.
join
(
repo
.
working_dir
,
file_path
)
# Prevent relative links
unless
safe_path?
(
file_path_in_satellite
)
Gitlab
::
GitLogger
.
error
(
"FileAction: Relative path not allowed"
)
return
false
end
File
.
delete
(
file_path_in_satellite
)
# add removed file
repo
.
remove
(
file_path_in_satellite
)
# commit the changes
# will raise CommandFailed when commit fails
repo
.
git
.
commit
(
raise:
true
,
timeout:
true
,
a:
true
,
m:
commit_message
)
# push commit back to bare repo
# will raise CommandFailed when push fails
repo
.
git
.
push
({
raise:
true
,
timeout:
true
},
:origin
,
ref
)
# everything worked
true
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
Gitlab
::
GitLogger
.
error
(
ex
.
message
)
false
end
end
end
end
lib/gitlab/satellite/files/file_action.rb
deleted
100644 → 0
View file @
435f680b
module
Gitlab
module
Satellite
class
FileAction
<
Action
attr_accessor
:file_path
,
:ref
def
initialize
(
user
,
project
,
ref
,
file_path
)
super
user
,
project
@file_path
=
file_path
@ref
=
ref
end
def
safe_path?
(
path
)
File
.
absolute_path
(
path
)
==
path
end
end
end
end
spec/requests/api/files_spec.rb
View file @
d684b110
...
...
@@ -49,10 +49,6 @@ describe API::API, api: true do
}
it
"should create a new file in project repo"
do
Gitlab
::
Satellite
::
NewFileAction
.
any_instance
.
stub
(
commit!:
true
,
)
post
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'file_path'
]).
to
eq
(
'newfile.rb'
)
...
...
@@ -84,10 +80,6 @@ describe API::API, api: true do
}
it
"should update existing file in project repo"
do
Gitlab
::
Satellite
::
EditFileAction
.
any_instance
.
stub
(
commit!:
true
,
)
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'file_path'
]).
to
eq
(
file_path
)
...
...
@@ -109,10 +101,6 @@ describe API::API, api: true do
}
it
"should delete existing file in project repo"
do
Gitlab
::
Satellite
::
DeleteFileAction
.
any_instance
.
stub
(
commit!:
true
,
)
delete
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'file_path'
]).
to
eq
(
file_path
)
...
...
@@ -124,8 +112,8 @@ describe API::API, api: true do
end
it
"should return a 400 if satellite fails to create file"
do
Gitlab
::
Satellite
::
DeleteFileAction
.
any_instance
.
stub
(
commit!
:
false
,
Repository
.
any_instance
.
stub
(
remove_file
:
false
,
)
delete
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
...
...
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