Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Fix GetArchiveUrl and updated docs #142

Merged
merged 2 commits into from
Jul 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Get archive
Returns the compressed archive for the specified `repository` with the given `ref` (commit, tag or branch).

* Method: GET
* URI: /repository/`:name`/archive/`:ref.:format`
* URI: /repository/`:name`/archive?ref=:ref&format=:format
* Format: binary

Where:
Expand All @@ -126,9 +126,9 @@ Where:

Example URLs (http://gandalf-server omitted for clarity)::

$ curl /repository/myrepository/archive/master.zip # gets master and zip format
$ curl /repository/myrepository/archive/master.tar.gz # gets master and tar.gz format
$ curl /repository/myrepository/archive/0.1.0.zip # gets 0.1.0 tag and zip format
$ curl /repository/myrepository/archive?ref=master&format=zip # gets master and zip format
$ curl /repository/myrepository/archive?ref=master&format=tar.gz # gets master and tar.gz format
$ curl /repository/myrepository/archive?ref=0.1.0&format=zip # gets 0.1.0 tag and zip format

Get branch
-----------
Expand Down Expand Up @@ -161,8 +161,8 @@ Example result::
date: "Tue Jul 29 13:43:57 2014 -0300"
},
_links: {
zipArchive: "/repository/myrepository/branch/archive/master.zip",
tarArchive: "/repository/myrepository/branch/archive/master.tar.gz"
zipArchive: "/repository/myrepository/branch/archive?ref=master&format=zip",
tarArchive: "/repository/myrepository/branch/archive?ref=master&format=tar.gz"
}
}]

Expand Down Expand Up @@ -201,8 +201,8 @@ Example result::
date: "Tue Jul 29 13:43:57 2014 -0300"
},
_links: {
zipArchive: "/repository/myrepository/branch/archive/0.1.zip",
tarArchive: "/repository/myrepository/branch/archive/0.1.tar.gz"
zipArchive: "/repository/myrepository/branch/archive?ref=0.1&format=zip",
tarArchive: "/repository/myrepository/branch/archive?ref=0.1&format=tar.gz"
}
}]

Expand Down
2 changes: 1 addition & 1 deletion repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func RevokeAccess(rNames, uNames []string) error {
}

func GetArchiveUrl(repo, ref, format string) string {
url := "/repository/%s/archive/%s.%s"
url := "/repository/%s/archive?ref=%s&format=%s"
return fmt.Sprintf(url, repo, ref, format)
}

Expand Down
2 changes: 1 addition & 1 deletion repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,5 +1123,5 @@ func (s *S) TestGetTagIntegration(c *gocheck.C) {

func (s *S) TestGetArchiveUrl(c *gocheck.C) {
url := GetArchiveUrl("repo", "ref", "zip")
c.Assert(url, gocheck.Equals, fmt.Sprintf("/repository/%s/archive/%s.%s", "repo", "ref", "zip"))
c.Assert(url, gocheck.Equals, fmt.Sprintf("/repository/%s/archive?ref=%s&format=%s", "repo", "ref", "zip"))
}