Provide a method to write a tree to an archive#421
Merged
jdavid merged 1 commit intolibgit2:masterfrom Sep 8, 2014
Merged
Conversation
fa1c138 to
d8c9840
Compare
Add Repository.write_archive() to write a given tree to an archive. As there are many customisation options, we only provide a method to write to an archive which is created by the user.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Repository.write_archive() to write a given tree to an archive. As
there are many customisation options, we only provide a method to write
to an archive which is created by the user.
Off of #358 this provides a standard way of writing some data into a tarfile, giving the user control over the interesting parts while doing the boring loop. I added the timestamp as a way to provide a timestamp from e.g. a commit when writing a subtree (and thus cannot pass the commit as the treeish), but I don't think we should add much more, since the point of this is to do whatever git does and provide a starting point if someone wants to write stuff in a custom way.
There may be a way to perform one less copy when reading from the object, as IIRC this was written before we had a memoryview into blobs, but this should be good enough for now.