Skip to content

Commit

Permalink
Add "hard reset" operation (#7263)
Browse files Browse the repository at this point in the history
* Add "hard reset" operation

* Add Esti test for hard reset

* make gen

* Separate "hard reset" API from regular ("soft") reset API

The 2 APIs share almost no parameters.  While Git gets away with using the
same verb for several different "reset" operations, this is very confusing
in OpenAPI.

* [CR] Use Graveler branch utilities to hard-reset, check if dirty first

* [bug] Validate Ref type

Validation reports compile-time type errors at run-time ;-(.

* [bug] Reset to "branch~"

Was tpyoed to "branch/", which is obviously wrong.

* Move API to "experimental" and clean up Swagger leftovers

* Use "expected, actual" style in require.Equal in test

* [bug] Return created metarange ID on Commit

Caused strange failures like [this one](https://github.com/treeverse/lakeFS/actions/runs/7486726066/job/20377896805?pr=7263#step:4:7210)
  • Loading branch information
arielshaqed authored Jan 11, 2024
1 parent 89b5772 commit d37c9bc
Show file tree
Hide file tree
Showing 33 changed files with 1,629 additions and 17 deletions.
50 changes: 50 additions & 0 deletions api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ components:
type:
type: string
enum: [object, common_prefix, reset]
description: What to reset according to path.
path:
type: string
force:
Expand Down Expand Up @@ -3379,6 +3380,55 @@ paths:
default:
$ref: "#/components/responses/ServerError"

/repositories/{repository}/branches/{branch}/hard_reset:
parameters:
- in: path
name: repository
required: true
schema:
type: string
- in: path
name: branch
required: true
schema:
type: string
put:
tags:
- experimental
operationId: hardResetBranch
summary: hard reset branch
description:
Relocate branch to refer to ref. Branch must not contain
uncommitted data.
parameters:
- in: query
name: ref
required: true
schema:
type: string
description: After reset, branch will point at this reference.
- in: query
name: force
required: false
schema:
type: boolean
default: false
responses:
204:
description: reset successful
400:
$ref: "#/components/responses/BadRequest"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFound"
420:
description: too many requests
default:
$ref: "#/components/responses/ServerError"

/repositories/{repository}/branches/{branch}/revert:
parameters:
- in: path
Expand Down
1 change: 1 addition & 0 deletions clients/java-legacy/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions clients/java-legacy/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions clients/java-legacy/docs/ExperimentalApi.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/java-legacy/docs/ResetCreation.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d37c9bc

Please sign in to comment.