-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/2935 lakectl bug on not found html #2966
Changes from 9 commits
855e9ce
704cacd
3066a9c
574c765
f7bb6ea
3160b53
08582c2
360d462
3513f29
688de92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package cmd | ||
|
||
import ( | ||
"net/http" | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/treeverse/lakefs/pkg/api" | ||
) | ||
|
||
|
@@ -31,29 +33,29 @@ var annotateCmd = &cobra.Command{ | |
client := getClient() | ||
pfx := api.PaginationPrefix(*pathURI.Path) | ||
context := cmd.Context() | ||
res, err := client.ListObjectsWithResponse(context, pathURI.Repository, pathURI.Ref, &api.ListObjectsParams{Prefix: &pfx}) | ||
DieOnResponseError(res, err) | ||
resp, err := client.ListObjectsWithResponse(context, pathURI.Repository, pathURI.Ref, &api.ListObjectsParams{Prefix: &pfx}) | ||
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusOK) | ||
var from string | ||
for { | ||
params := &api.ListObjectsParams{ | ||
Prefix: &pfx, | ||
After: api.PaginationAfterPtr(from), | ||
} | ||
resp, err := client.ListObjectsWithResponse(context, pathURI.Repository, pathURI.Ref, params) | ||
DieOnResponseError(resp, err) | ||
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusOK) | ||
for _, obj := range resp.JSON200.Results { | ||
logCommitsParams := &api.LogCommitsParams{ | ||
Amount: api.PaginationAmountPtr(1), | ||
Objects: &[]string{obj.Path}, | ||
} | ||
res, err := client.LogCommitsWithResponse(context, pathURI.Repository, pathURI.Ref, logCommitsParams) | ||
DieOnResponseError(res, err) | ||
resp, err := client.LogCommitsWithResponse(context, pathURI.Repository, pathURI.Ref, logCommitsParams) | ||
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusOK) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually incorrect, because l.51 assigned to If you can, I would feel safely if you could: pick one spelling, and search-and-destroy the entire cmd directory for the other one ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[ariels@fedora lakeFS]$ git grep -w res cmd/
cmd/lakectl/cmd/tag.go: res, err := client.GetCommitWithResponse(ctx, tagURI.Repository, commitRef)
cmd/lakectl/cmd/tag.go: DieOnErrorOrUnexpectedStatusCode(res, err, http.StatusOK) This inconsistency is precisely what got us into trouble on this line. So could you fix that one too, please, even though it is not strictly related to this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My 2 cents - use different names so we will not verify or check the wrong response by mistake |
||
data := objectCommitData{ | ||
Object: obj.Path, | ||
} | ||
if len(res.JSON200.Results) > 0 { | ||
data.Commit = res.JSON200.Results[0] | ||
data.CommitMessage = splitOnNewLine(stringTrimLen((res.JSON200.Results[0].Message), annotateMessageSize)) | ||
if len(resp.JSON200.Results) > 0 { | ||
data.Commit = resp.JSON200.Results[0] | ||
data.CommitMessage = splitOnNewLine(stringTrimLen((resp.JSON200.Results[0].Message), annotateMessageSize)) | ||
} | ||
Write(annotateTemplate, data) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion - pick a shorter name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DieOnUnexpectedResponse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, no good suggestion