summaryrefslogtreecommitdiff
path: root/lib/gitlab/import_export.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-07-15 12:47:06 +0200
committerJames Lopez <james@jameslopez.es>2016-07-15 12:55:28 +0200
commit65549a5866da6ceaf7ee4052736077879b5e641d (patch)
tree9aea20cd1061f8762d50d169a22084a5c1ef3348 /lib/gitlab/import_export.rb
parent86f83db2b0ebc6d4cf546a71e151bb8552215a3a (diff)
downloadgitlab-ce-65549a5866da6ceaf7ee4052736077879b5e641d.tar.gz
add project name and namespace to filename on project export
added changelog
Diffstat (limited to 'lib/gitlab/import_export.rb')
-rw-r--r--lib/gitlab/import_export.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/import_export.rb b/lib/gitlab/import_export.rb
index 588647e5adb..bab2ea73c4f 100644
--- a/lib/gitlab/import_export.rb
+++ b/lib/gitlab/import_export.rb
@@ -3,6 +3,7 @@ module Gitlab
extend self
VERSION = '0.1.1'
+ FILENAME_LIMIT = 50
def export_path(relative_path:)
File.join(storage_path, relative_path)
@@ -28,6 +29,12 @@ module Gitlab
'VERSION'
end
+ def export_filename(project:)
+ basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.namespace.path}_#{project.path}"
+
+ "#{basename[0..FILENAME_LIMIT]}_export.tar.gz"
+ end
+
def version
VERSION
end