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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
91a44699
Commit
91a44699
authored
Aug 05, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for XZ archive format
( will send upstream if it works )
parent
1aafce0d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
app/views/projects/repositories/_download_archive.html.haml
app/views/projects/repositories/_download_archive.html.haml
+4
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+2
-2
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+9
-0
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+4
-0
No files found.
app/views/projects/repositories/_download_archive.html.haml
View file @
91a44699
...
...
@@ -23,6 +23,10 @@
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
ref
,
format:
'tar.bz2'
),
rel:
'nofollow'
do
%i
.fa.fa-download
%span
Download tar.bz2
%li
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
ref
,
format:
'tar.xz'
),
rel:
'nofollow'
do
%i
.fa.fa-download
%span
Download tar.xz
%li
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
ref
,
format:
'tar'
),
rel:
'nofollow'
do
%i
.fa.fa-download
...
...
lib/gitlab/regex.rb
View file @
91a44699
...
...
@@ -70,8 +70,8 @@ module Gitlab
def
archive_formats_regex
# |zip|tar| tar.gz | tar.bz2 |
@archive_formats_regex
||=
/(zip|tar|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
.
freeze
# |zip|tar| tar.gz | tar.bz2 |
tar.xz |
@archive_formats_regex
||=
/(zip|tar|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2
|tar\.xz|txz|xz
)/
.
freeze
end
def
git_reference_regex
...
...
spec/requests/api/repositories_spec.rb
View file @
91a44699
...
...
@@ -115,6 +115,15 @@ describe API::API, api: true do
expect
(
params
[
'ArchivePath'
]).
to
match
(
/
#{
repo_name
}
\-[^\.]+\.tar.bz2/
)
end
it
"should get the archive.tar.xz"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/archive.tar.xz"
,
user
)
repo_name
=
project
.
repository
.
name
.
gsub
(
"
\.
git"
,
""
)
expect
(
response
.
status
).
to
eq
(
200
)
type
,
params
=
workhorse_send_data
expect
(
type
).
to
eq
(
'git-archive'
)
expect
(
params
[
'ArchivePath'
]).
to
match
(
/
#{
repo_name
}
\-[^\.]+\.tar.xz/
)
end
it
"should return 404 for invalid sha"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/archive/?sha=xxx"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
...
...
spec/routing/project_routing_spec.rb
View file @
91a44699
...
...
@@ -136,6 +136,10 @@ describe Projects::RepositoriesController, 'routing' do
expect
(
get
(
'/gitlab/gitlabhq/repository/archive.tar.bz2'
)).
to
route_to
(
'projects/repositories#archive'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
format:
'tar.bz2'
)
end
it
'to #archive format:tar.xz'
do
expect
(
get
(
'/gitlab/gitlabhq/repository/archive.tar.xz'
)).
to
route_to
(
'projects/repositories#archive'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
format:
'tar.xz'
)
end
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/repository'
)).
to
route_to
(
'projects/repositories#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
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