-
Notifications
You must be signed in to change notification settings - Fork 349
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
added optional allow empty commits #7186
Conversation
8634cd4
to
bfdb40a
Compare
8b64a80
to
991b053
Compare
pkg/graveler/graveler.go
Outdated
@@ -436,6 +436,7 @@ type CommitParams struct { | |||
Metadata Metadata | |||
// SourceMetaRange - If exists, use it directly. Fail if branch has uncommitted changes | |||
SourceMetaRange *MetaRangeID | |||
AllowEmpty *bool |
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.
Why a pointer?
@@ -558,6 +558,10 @@ components: | |||
description: set date to override creation date in the commit (Unix Epoch in seconds) | |||
type: integer | |||
format: int64 | |||
allow_empty: | |||
description: sets whether a commit can contain no changes |
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.
description: sets whether a commit can contain no changes | |
description: allow commits without any changes |
7027552
to
95557ee
Compare
c1ba509
to
138bfd7
Compare
♻️ PR Preview b5edb3e has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
138bfd7
to
fdf3d30
Compare
fdf3d30
to
aaf97e6
Compare
pkg/api/controller.go
Outdated
@@ -2520,7 +2520,7 @@ func (c *Controller) Commit(w http.ResponseWriter, r *http.Request, body apigen. | |||
metadata = body.Metadata.AdditionalProperties | |||
} | |||
|
|||
newCommit, err := c.Catalog.Commit(ctx, repository, branch, body.Message, user.Committer(), metadata, body.Date, params.SourceMetarange, graveler.WithForce(swag.BoolValue(body.Force))) | |||
newCommit, err := c.Catalog.Commit(ctx, repository, branch, body.Message, user.Committer(), metadata, body.Date, params.SourceMetarange, body.AllowEmpty, graveler.WithForce(swag.BoolValue(body.Force))) |
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.
use swag.BoolValue to pass allow empty to the underlying layer. we no longer need pointer to represent optional.
pkg/catalog/catalog.go
Outdated
@@ -1110,7 +1110,7 @@ func (c *Catalog) ResetEntries(ctx context.Context, repositoryID string, branch | |||
return c.Store.ResetPrefix(ctx, repository, branchID, keyPrefix, opts...) | |||
} | |||
|
|||
func (c *Catalog) Commit(ctx context.Context, repositoryID, branch, message, committer string, metadata Metadata, date *int64, sourceMetarange *string, opts ...graveler.SetOptionsFunc) (*CommitLog, error) { | |||
func (c *Catalog) Commit(ctx context.Context, repositoryID, branch, message, committer string, metadata Metadata, date *int64, sourceMetarange *string, allowEmpty *bool, opts ...graveler.SetOptionsFunc) (*CommitLog, error) { |
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.
Think we should refactor the signature - can be in a different pr and just pass commit params/options same struct layout as we pass to graveler so it will not stay a long list of arguments. When using struct the default value of each parameter will represent the default behaviour and the caller will not pass pointers to date and source metarange.
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.
LGTM! thanks for the quick fix.
@lynnro314 Can we add this to Python Wrapper also? |
Closes #7042