diff --git a/api/swagger.yml b/api/swagger.yml index ccc64c98a9d..a8e335b9d21 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -476,7 +476,7 @@ components: allow_empty: type: boolean default: false - description: allow reverts without any changes + description: allow empty commit (revert without changes) CherryPickCreation: type: object diff --git a/cmd/lakectl/cmd/branch_revert.go b/cmd/lakectl/cmd/branch_revert.go index 10c548c23ab..6ab8f8b4c08 100644 --- a/cmd/lakectl/cmd/branch_revert.go +++ b/cmd/lakectl/cmd/branch_revert.go @@ -12,7 +12,7 @@ import ( const ( branchRevertCmdArgs = 2 ParentNumberFlagName = "parent-number" - allowEmptyRevert = "allow-empty-revert" + allowEmptyRevert = "allow-empty-commit" ) // lakectl branch revert lakefs://myrepo/main commitId @@ -61,7 +61,7 @@ func init() { AssignAutoConfirmFlag(branchRevertCmd.Flags()) branchRevertCmd.Flags().IntP(ParentNumberFlagName, "m", 0, "the parent number (starting from 1) of the mainline. The revert will reverse the change relative to the specified parent.") - branchRevertCmd.Flags().Bool(allowEmptyRevert, false, "allow revert with no changes") + branchRevertCmd.Flags().Bool(allowEmptyRevert, false, "allow empty commit (revert without changes)") branchCmd.AddCommand(branchRevertCmd) } diff --git a/pkg/catalog/catalog.go b/pkg/catalog/catalog.go index 41ca684155a..aa9a55c202d 100644 --- a/pkg/catalog/catalog.go +++ b/pkg/catalog/catalog.go @@ -148,7 +148,7 @@ type RevertParams struct { Reference string // the commit to revert ParentNumber int // if reverting a merge commit, the change will be reversed relative to this parent number (1-based). Committer string - AllowEmpty bool // allow revert with no changes + AllowEmpty bool // allow empty commit (revert without changes) } type CherryPickParams struct { diff --git a/pkg/graveler/errors.go b/pkg/graveler/errors.go index f48c620f23c..a05306a780c 100644 --- a/pkg/graveler/errors.go +++ b/pkg/graveler/errors.go @@ -61,7 +61,6 @@ var ( ErrSkipValueUpdate = errors.New("skip value update") ErrImport = wrapError(ErrUserVisible, "import error") ErrReadOnlyRepository = wrapError(ErrUserVisible, "read-only repository") - ErrEmptyRevert = wrapError(ErrUserVisible, "revert with no changes") ) // wrappedError is an error for wrapping another error while ignoring its message. diff --git a/pkg/graveler/graveler.go b/pkg/graveler/graveler.go index 9dc0f0c9d0b..dcee42405f9 100644 --- a/pkg/graveler/graveler.go +++ b/pkg/graveler/graveler.go @@ -2552,7 +2552,7 @@ func (g *Graveler) Revert(ctx context.Context, repository *RepositoryRecord, bra // merge from the parent to the top of the branch, with the given ref as the merge base: metaRangeID, err := g.CommittedManager.Merge(ctx, repository.StorageNamespace, branchCommit.MetaRangeID, parentMetaRangeID, commitRecord.MetaRangeID, MergeStrategyNone) if (metaRangeID == branchCommit.MetaRangeID) && !commitParams.AllowEmpty { - return nil, ErrEmptyRevert + return nil, ErrNoChanges } if err != nil { if !errors.Is(err, ErrUserVisible) {