gerrit: add ability to pass QueryChangesOpt to GetChangeDetail

The existing implementation of GetChangeDetail does not allow for
an optional QueryChangesOpt. QueryChangesOpt adds the ability to
pass options such as CURRENT_FILES and CURRENT_REVISION in order
to receive a more detailed ChangeInfo struct.

Change-Id: I7925e75821538b2720fff7d62c8404ed97e18791
Reviewed-on: https://go-review.googlesource.com/34922
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/gerrit/gerrit.go b/gerrit/gerrit.go
index fbdc7a8..b983d90 100644
--- a/gerrit/gerrit.go
+++ b/gerrit/gerrit.go
@@ -345,9 +345,19 @@
 // GetChangeDetail retrieves a change with labels, detailed labels, detailed
 // accounts, and messages.
 // For the API call, see https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change-detail
-func (c *Client) GetChangeDetail(changeID string) (*ChangeInfo, error) {
+func (c *Client) GetChangeDetail(changeID string, opts ...QueryChangesOpt) (*ChangeInfo, error) {
+	var opt QueryChangesOpt
+	switch len(opts) {
+	case 0:
+	case 1:
+		opt = opts[0]
+	default:
+		return nil, errors.New("only 1 option struct supported")
+	}
 	var change ChangeInfo
-	err := c.do(&change, "GET", "/changes/"+changeID+"/detail")
+	err := c.do(&change, "GET", "/changes/"+changeID+"/detail", urlValues{
+		"o": opt.Fields,
+	})
 	if err != nil {
 		return nil, err
 	}