-
Notifications
You must be signed in to change notification settings - Fork 293
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
OstreeMutableTree: add _remove method #1724
Conversation
Hmm, there's no way either to remove directories, right? Maybe a dedicated I guess we could enhance the semantics of |
Makes sense. I was thinking about how to work around the lack of removal by recursively walking my MutableTree and making a new one without the stuff I wanted to remove, but it seems there's also no API for adding a subdir which is an already existing MutableTree. This whole thing is driving me nuts. Anyway - here is a _remove method, which solves the problem at hand! |
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.
Just one suggestion below, otherwise LGTM!
but it seems there's also no API for adding a subdir which is an already existing MutableTree
Hmm, yeah you're right. If it's a tree that was initialized from an ostree commit, you can at least use ostree_repo_write_directory_to_mtree()
with the root tree (or a subdir).
My impression is that it's more common to do any extensive manipulations by just checking out the files to disk, edit things there, and then recommit it back. With the devino cache, performance is pretty good. (#1651 is related here; it adds a new --prefix
commit option).
There is no API method to remove a file or subdirectory from a MutableTree besides directly manipulating the GHashTable returned by _get_files or _get_subdirs. This isn't possible from an introspection binding that transforms the returned GHashTable, and may also leave the tree checksum in an invalid state. Introduce a new method so that removing files or subdirectories is safe, and possible from bindings.
Awesome, thanks a lot! (That whole file needs to be ported to the new style, but let's do that separately.) |
There is no API method to remove a file or subdirectory from a MutableTree besides directly manipulating the GHashTable returned by _get_files or _get_subdirs. This isn't possible from an introspection binding that transforms the returned GHashTable, and may also leave the tree checksum in an invalid state. Introduce a new method so that removing files or subdirectories is safe, and possible from bindings. Closes: #1724 Approved by: jlebon
@rh-atomic-bot retry |
There is no API method to remove a file or subdirectory from a MutableTree besides directly manipulating the GHashTable returned by _get_files or _get_subdirs. This isn't possible from an introspection binding that transforms the returned GHashTable, and may also leave the tree checksum in an invalid state. Introduce a new method so that removing files or subdirectories is safe, and possible from bindings. Closes: #1724 Approved by: jlebon
💔 Test failed - status-atomicjenkins |
@rh-atomic-bot retry |
☀️ Test successful - status-atomicjenkins |
There is no API method to remove a file or subdirectory from a MutableTree besides directly manipulating the GHashTable returned by _get_files or _get_subdirs. This isn't possible from an introspection binding that transforms the returned GHashTable, and may also leave the tree checksum in an invalid state. Introduce a new method so that removing files or subdirectories is safe, and possible from bindings. Closes: ostreedev#1724 Approved by: jlebon (cherry picked from commit ca32ff7) Signed-off-by: Robert McQueen <rob@endlessm.com>
There is no API method to remove a file from a MutableTree besides directly manipulating the GHashTable returned by _get_files. This isn't possible from an introspection binding that transforms the returned GHashTable, and may also leave the tree checksum in an invalid state.
Allow NULL to remove a file entry, add GI annotations to show that checksum is nullable.Introduce a new method to allow removing files or subdirectories.