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

Commit

Permalink
Client.Commit: Fix issue that "commit" command line with tag
Browse files Browse the repository at this point in the history
Current hyperctl commit will get error if command line has tag.
The reason is tag should be moved out as a special commit option from
repo in hyperctl.

Update Client.Commit to handle the issue.

Signed-off-by: Hui Zhu <teawater@hyper.sh>
  • Loading branch information
teawater committed Jul 23, 2018
1 parent 872d4fe commit effb4b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/api/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"net/url"
"strings"

"github.com/hyperhq/hyperd/engine"
)
Expand All @@ -22,7 +23,16 @@ func (cli *Client) Commit(container, repo, author, message string, changes []str
v.Set("pause", "no")
}
v.Set("container", container)
tag := ""
if repo != "" {
s := strings.Split(repo, ":")
if len(s) == 2 {
repo = s[0]
tag = s[1]
}
}
v.Set("repo", repo)
v.Set("tag", tag)
body, _, err := readBody(cli.call("POST", "/container/commit?"+v.Encode(), nil, nil))
if err != nil {
return "", err
Expand Down

0 comments on commit effb4b0

Please sign in to comment.