jbrukh / ggit

ggit
17 stars 2 forks source link

Expose unpack-objects / pack-objects #51

Open themihai opened 8 years ago

themihai commented 8 years ago

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).

MikeBosw commented 8 years ago

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

jbrukh commented 8 years ago

@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.

MikeBosw commented 8 years ago

@jbrukh think the issue might be:

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

jbrukh commented 8 years ago

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.

themihai commented 8 years ago

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.

MikeBosw commented 8 years ago

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

jbrukh commented 8 years ago

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

On Tue, Feb 16, 2016 at 11:58 AM, Michael Bosworth <notifications@github.com

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.