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
Tatuya Kamada
gitlab-ce
Commits
9f1a4acf
Commit
9f1a4acf
authored
Jan 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2207 from koenpunt/system-to-fileutils
replaced system() calls with FileUtils.* methods
parents
546dd4c2
6b9177ca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
app/models/namespace.rb
app/models/namespace.rb
+6
-5
lib/gitlab/project_mover.rb
lib/gitlab/project_mover.rb
+6
-5
No files found.
app/models/namespace.rb
View file @
9f1a4acf
...
...
@@ -52,7 +52,7 @@ class Namespace < ActiveRecord::Base
def
ensure_dir_exist
unless
dir_exists?
system
(
"mkdir -m 770
#{
namespace_full_path
}
"
)
FileUtils
.
mkdir
(
namespace_full_path
,
mode:
0770
)
end
end
...
...
@@ -72,10 +72,11 @@ class Namespace < ActiveRecord::Base
raise
"Already exists"
end
if
system
(
"mv
#{
old_path
}
#{
new_path
}
"
)
begin
FileUtils
.
mv
(
old_path
,
new_path
)
send_update_instructions
@require_update_gitolite
=
true
els
e
rescue
Exception
=>
e
raise
"Namespace move error
#{
old_path
}
#{
new_path
}
"
end
end
...
...
@@ -88,7 +89,7 @@ class Namespace < ActiveRecord::Base
def
rm_dir
dir_path
=
File
.
join
(
Gitlab
.
config
.
gitolite
.
repos_path
,
path
)
system
(
"rm -rf
#{
dir_path
}
"
)
FileUtils
.
rm_r
(
dir_path
,
force:
true
)
end
def
send_update_instructions
...
...
lib/gitlab/project_mover.rb
View file @
9f1a4acf
...
...
@@ -16,7 +16,7 @@ module Gitlab
def
execute
# Create new dir if missing
new_dir_path
=
File
.
join
(
Gitlab
.
config
.
gitolite
.
repos_path
,
new_dir
)
system
(
"mkdir -m 770
#{
new_dir_path
}
"
)
unless
File
.
exists?
(
new_dir_path
)
FileUtils
.
mkdir
(
new_dir_path
,
mode:
0770
)
unless
File
.
exists?
(
new_dir_path
)
old_path
=
File
.
join
(
Gitlab
.
config
.
gitolite
.
repos_path
,
old_dir
,
"
#{
project
.
path
}
.git"
)
new_path
=
File
.
join
(
new_dir_path
,
"
#{
project
.
path
}
.git"
)
...
...
@@ -25,12 +25,13 @@ module Gitlab
raise
ProjectMoveError
.
new
(
"Destination
#{
new_path
}
already exists"
)
end
if
system
(
"mv
#{
old_path
}
#{
new_path
}
"
)
begin
FileUtils
.
mv
(
old_path
,
new_path
)
log_info
"Project
#{
project
.
name
}
was moved from
#{
old_path
}
to
#{
new_path
}
"
true
els
e
rescue
Exception
=>
e
message
=
"Project
#{
project
.
name
}
cannot be moved from
#{
old_path
}
to
#{
new_path
}
"
log_info
"Error!
#{
message
}
"
log_info
"Error!
#{
message
}
(
#{
e
.
message
}
)
"
raise
ProjectMoveError
.
new
(
message
)
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