-
Notifications
You must be signed in to change notification settings - Fork 451
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
1162 Reorder operations correctly in commit endpoint #1175
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
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.
conceptual ACK
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
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.
Very nice, thanks!
@@ -46,3 +50,49 @@ def test_explicit_folder(self): | |||
def test_is_folder_wrong_value(self): | |||
with self.assertRaises(ValueError): | |||
CommitOperationDelete(path_in_repo="path/to/folder", is_folder="any value") | |||
|
|||
|
|||
class TestWarnOnOverwritingOperations(unittest.TestCase): |
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.
Clean class!
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
Thanks for the reviews @coyotte508 @LysandreJik ! I'm merging :) |
Fix #1162.
With this PR:
create_commit(...)
. It was not the case before which causes trouble if someone wants to delete then create a file.CommitOperationAdd
is validated at initialization (no need for.validate()
or._upload_info()
calls anymore)Warning: I made some breaking changes in
validate_preupload_info
,fetch_upload_modes
andprepare_commit_payload
. I did not care too much as those 3 methods are defined in a private module and used exclusively for the increate_commit
. I checked for safety and it's not used anywhere indiffusers
,transformers
,skops
anddatasets
.Potential issue: if someone adds twice the same file, once a LFS content, once a regular content then the final upload mode will be the one from the second operation. Might cause issue with request payload or gitaly. Anyway, this is a weird case so let's not care of the user has an error. A warning message is triggered before upload so the user should notice the problem. (note: this issue was already existing before this PR)
(cc @severo who raised the issue)