ggit icon indicating copy to clipboard operation
ggit copied to clipboard

Expose unpack-objects / pack-objects

Open themihai opened this issue 9 years ago • 7 comments

Is there any plan to expose unpack-objects / pack-objects functionality (i.e. pack.go) on the public API? My use case is that I don't have access to a file system so I need to unpack objects in memory (or on a proprietary storage engine such S3).

themihai avatar Feb 12 '16 11:02 themihai

Just wanted to acknowledge that I saw the suggestion and yeah, definitely seems like a good idea. Thanks!

MikeBosw avatar Feb 12 '16 20:02 MikeBosw

@themihai This project is unmaintained, experimental, and not recommended for any kind of production use. That being said, the current code allows you to read pack data from any bufio.Reader

https://github.com/jbrukh/ggit/blob/master/api/parse/pack.go#L284-L291

which means you can implement a reader backed by memory, S3, etc.

jbrukh avatar Feb 12 '16 21:02 jbrukh

@jbrukh think the issue might be:

type Opener func() (*os.File, error)

MikeBosw avatar Feb 12 '16 21:02 MikeBosw

Ah, right on. If you're not using any kind of os.File specific functionality, might as well make that an io.Reader. From what I recall from 30 years ago when we made this, the api.Repository interface is abstract in order to be able to support different kinds of repository backends, but the ggit command certainly assumes a DiskRepository at the moment.

jbrukh avatar Feb 12 '16 21:02 jbrukh

I thought the same. An io.ReadWriterCloser at most should suffice unless I'm missing something. NewPackIdxParser also seems to require an idx file rather than pack file.

themihai avatar Feb 13 '16 11:02 themihai

Hi. Not to shoot our here lonely project in the face, but the following just showed up on Hacker News:

https://github.com/src-d/go-git

MikeBosw avatar Feb 16 '16 16:02 MikeBosw

Very cool -- it was just a matter of time. :)

On Tue, Feb 16, 2016 at 11:58 AM, Michael Bosworth <[email protected]

wrote:

Hi. Not to shoot our here lonely project in the face, but the following just showed up on Hacker News:

https://github.com/src-d/go-git

— Reply to this email directly or view it on GitHub https://github.com/jbrukh/ggit/issues/51#issuecomment-184769879.

jbrukh avatar Feb 16 '16 17:02 jbrukh