Skip to content

Commit

Permalink
fix(publish): Can only publish / unpublish a head reference
Browse files Browse the repository at this point in the history
  • Loading branch information
dustmop committed Nov 4, 2019
1 parent 1348506 commit f834621
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ to a published dataset will be immediately visible to connected peers.
$ qri publish me/dataset me/other_dataset
# unpublish a dataset
$ qri publish -unpublish me/dataset
$ qri publish --unpublish me/dataset
# publish a few dataset on p2p only
$ qri publish --no-registry me/dataset_2`,
Expand Down
9 changes: 9 additions & 0 deletions lib/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lib

import (
"context"
"fmt"

"github.com/qri-io/qri/base"
"github.com/qri-io/qri/remote"
Expand Down Expand Up @@ -82,6 +83,9 @@ func (r *RemoteMethods) Publish(p *PublicationParams, res *repo.DatasetRef) erro
if err != nil {
return err
}
if ref.Path != "" {
return fmt.Errorf("can only publish entire dataset, cannot use version %s", ref.Path)
}
if err = repo.CanonicalizeDatasetRef(r.inst.Repo(), &ref); err != nil {
return err
}
Expand Down Expand Up @@ -121,6 +125,11 @@ func (r *RemoteMethods) Unpublish(p *PublicationParams, res *repo.DatasetRef) er
if err != nil {
return err
}

if ref.Path != "" {
return fmt.Errorf("can only unpublish entire dataset, cannot use version %s", ref.Path)
}

if err = repo.CanonicalizeDatasetRef(r.inst.Repo(), &ref); err != nil {
return err
}
Expand Down

0 comments on commit f834621

Please sign in to comment.