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

Commit

Permalink
Merge pull request #142 from rfloriano/master
Browse files Browse the repository at this point in the history
Fix GetArchiveUrl and updated docs
  • Loading branch information
andrewsmedina committed Jul 30, 2014
2 parents 6f06e8c + 327e533 commit f8bb0a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
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"))
}

0 comments on commit f8bb0a8

Please sign in to comment.