Add Write(w io.Writer) to packbuilder
This wraps (*packbuilder).ForEach(), making it possible to write the pack easiliy to a tcp-connection, a HTTP-Body or the like.
This commit is contained in:
parent
140f362428
commit
1da989e28b
|
@ -74,6 +74,17 @@ func (pb *Packbuilder) WriteToFile(name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (pb *Packbuilder) Write(w io.Writer) error {
|
||||
ch := pb.Foreach()
|
||||
for _, slice := range ch {
|
||||
_, err := w.Write(slice)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pb *Packbuilder) Written() uint32 {
|
||||
return uint32(C.git_packbuilder_written(pb.ptr))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue