Skip to content
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

Merged
merged 7 commits into from
Jan 3, 2024
Merged

Conversation

lynnro314
Copy link
Contributor

Closes #7042

@lynnro314 lynnro314 added the include-changelog PR description should be included in next release changelog label Dec 20, 2023
Copy link

github-actions bot commented Dec 21, 2023

E2E Test Results - DynamoDB Local - Local Block Adapter

10 passed

@@ -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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: sets whether a commit can contain no changes
description: allow commits without any changes

Copy link

github-actions bot commented Jan 1, 2024

♻️ PR Preview b5edb3e has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@@ -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)))
Copy link
Contributor

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.

@@ -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) {
Copy link
Contributor

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.

Copy link
Contributor

@nopcoder nopcoder left a 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 lynnro314 marked this pull request as ready for review January 3, 2024 12:57
@lynnro314 lynnro314 merged commit 88247ac into master Jan 3, 2024
37 checks passed
@lynnro314 lynnro314 deleted the allow-forced-empty-commits branch January 3, 2024 12:57
@lynnro314 lynnro314 added minor-change Used for PRs that don't require issue attached and removed minor-change Used for PRs that don't require issue attached labels Jan 10, 2024
@kesarwam
Copy link
Contributor

@lynnro314 Can we add this to Python Wrapper also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow forced empty commits and merges
4 participants