From 87d4e16568f151cc7dc0f10b8c3f222024582489 Mon Sep 17 00:00:00 2001 From: shin- Date: Sun, 24 Mar 2013 14:38:10 -0700 Subject: [PATCH 1/3] Quick fix to avoid creating empty-string repositories when committing --- commands.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 1c2f8d0fdc..7edefd7124 100644 --- a/commands.go +++ b/commands.go @@ -627,7 +627,7 @@ func (srv *Server) CmdPs(stdin io.ReadCloser, stdout io.Writer, args ...string) func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...string) error { cmd := rcli.Subcmd(stdout, - "commit", "[OPTIONS] CONTAINER [REPOSITORY [TAG]]", + "commit", "[OPTIONS] CONTAINER REPOSITORY [TAG]", "Create a new image from a container's changes") fl_comment := cmd.String("m", "", "Commit message") if err := cmd.Parse(args); err != nil { @@ -638,6 +638,12 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri cmd.Usage() return nil } + + if repository == "" { + cmd.Usage() + return nil + } + img, err := srv.runtime.Commit(containerName, repository, tag, *fl_comment) if err != nil { return err From 938bf4c9019cf6b5f64ebcc6db782d858feac2fb Mon Sep 17 00:00:00 2001 From: shin- Date: Sun, 24 Mar 2013 14:53:00 -0700 Subject: [PATCH 2/3] Reverted previous change --- commands.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/commands.go b/commands.go index 7edefd7124..1c2f8d0fdc 100644 --- a/commands.go +++ b/commands.go @@ -627,7 +627,7 @@ func (srv *Server) CmdPs(stdin io.ReadCloser, stdout io.Writer, args ...string) func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...string) error { cmd := rcli.Subcmd(stdout, - "commit", "[OPTIONS] CONTAINER REPOSITORY [TAG]", + "commit", "[OPTIONS] CONTAINER [REPOSITORY [TAG]]", "Create a new image from a container's changes") fl_comment := cmd.String("m", "", "Commit message") if err := cmd.Parse(args); err != nil { @@ -638,12 +638,6 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri cmd.Usage() return nil } - - if repository == "" { - cmd.Usage() - return nil - } - img, err := srv.runtime.Commit(containerName, repository, tag, *fl_comment) if err != nil { return err From 0786d9ec22164afe17051e69dd462ebee6ddcbf9 Mon Sep 17 00:00:00 2001 From: shin- Date: Sun, 24 Mar 2013 15:01:41 -0700 Subject: [PATCH 3/3] Show instead of an empty string in docker images listing for images with no repository or tag --- commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 1c2f8d0fdc..0a6bff5a07 100644 --- a/commands.go +++ b/commands.go @@ -554,8 +554,8 @@ func (srv *Server) CmdImages(stdin io.ReadCloser, stdout io.Writer, args ...stri for id, image := range allImages { if !*quiet { for idx, field := range []string{ - /* REPOSITORY */ "", - /* TAG */ "", + /* REPOSITORY */ "", + /* TAG */ "", /* ID */ id, /* CREATED */ HumanDuration(time.Now().Sub(image.Created)) + " ago", /* PARENT */ srv.runtime.repositories.ImageName(image.Parent),