Skip to content

Commit

Permalink
fix(api status, body, get): fsi=true endpoints should not care if the…
Browse files Browse the repository at this point in the history
…re is no history

the only time we need to catch the `no history` error, is when we are asking to get the history
  • Loading branch information
ramfox authored and dustmop committed Aug 13, 2019
1 parent aa4dbb6 commit 0c7649f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions api/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,6 @@ func (h DatasetHandlers) bodyHandler(w http.ResponseWriter, r *http.Request) {

result := &lib.GetResult{}
err = h.Get(p, result)
if err == repo.ErrNoHistory {
NoHistoryErrResponse(w)
return
}
if err != nil {
util.WriteErrResponse(w, http.StatusInternalServerError, err)
return
Expand Down
2 changes: 1 addition & 1 deletion base/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ToDatasetRef(path string, r repo.Repo, allowFSI bool) (*repo.DatasetRef, er
}
err = repo.CanonicalizeDatasetRef(r, &ref)
if err == repo.ErrNoHistory && !allowFSI {
return nil, err
return &ref, err
}
return &ref, nil
}
2 changes: 1 addition & 1 deletion fsi/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (si statusItems) Less(i, j int) bool {
// AliasStatus returns the status for a given dataset alias
func (fsi *FSI) AliasStatus(alias string) (changes []StatusItem, err error) {
ref, err := fsi.getRepoRef(alias)
if err != nil {
if err != nil && err != repo.ErrNoHistory {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion lib/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *DatasetRequests) Get(p *GetParams, res *GetResult) (err error) {
}

ref, err := base.ToDatasetRef(p.Path, r.node.Repo, p.UseFSI)
if err != nil {
if err != nil && err != repo.ErrNoHistory {
return err
}

Expand Down

0 comments on commit 0c7649f

Please sign in to comment.