-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
getObject #50
Comments
@mojavelinux thoughts? |
I like the fact that you're using the same function to get each object in succession since that reflects how git actually works. I would think you'd need to specify the type/format for the last call in your example: let blob = await git.getObject({fs, dir, ref: file.oid, type: 'content'}) right? otherwise, I'd expect to get a BlobDescription based on your proposal. I'm worried we're overloading the meaning of "type" (see https://git-scm.com/docs/git-cat-file). Type is already used for the object type (tree, blob, etc). Perhaps format instead? |
True! It would probably be blob.data.toString() or something.
I thought I did call it format... no worries! I agree that 'type' already has a meaning. I definitely won't call it type. :) |
👍 |
I changed the names for more consistency / descriptiveness. Instead of |
So as nice as the high-level API is, there are times where you want to get your hands dirty, and do specialized batch operations without wasting time doing a full "git.checkout".
To that end, I'm thinking about adding an API function that would provide some of the benefits of using the GitObjectManager directly.
values for format:
'raw'
- returns raw deflate-compressed file. Useful for manually unpacking objects from packfiles or efficiently shuffling around loose objects - whenever you don't care about the contents you can save time by not unzipping them'plain'
- returns deflated object as Buffer. Useful for calculating SHA object ids'content'
- returns object content, minus the git header'parsed'
- default. parse the object and return a JavaScript object using one of the schemas (CommitDescription, BlobDescription, TreeDescription, TagDescription)Example usage:
The text was updated successfully, but these errors were encountered: