Commit Graph

14 Commits

Author SHA1 Message Date
Carlos Martín Nieto a9d993f3d1 Remove useless includes 2014-12-11 02:59:07 +01:00
Carlos Martín Nieto 8c631b0c25 Add missing thread locking 2014-12-06 02:45:26 +01:00
Carlos Martín Nieto 7e3c361ac4 Packbuilder: use a callback for ForEach instead of a channel
Channels provide no means to report an error. Closing a channel could
mean anything.

This is particularly important when dealing with IO, which we do quite
often in the pack builder. Use ForEach which returns an error instead.
2014-05-06 14:43:38 +02:00
Jesper Hansen 499f52a354 Added git error code to the error object. 2014-02-26 16:10:00 +01:00
Carlos Martín Nieto a40bdfd420 Lock the OS thread when acessing errors
The library stores error information in thread-local storage, which
means we need to make sure that the Go runtime doesn't switch OS
threads between the time we call a function and th time we attempt to
retrieve the error information.
2013-12-18 16:18:32 +01:00
Carlos Martín Nieto a5ad8de506 Don't repeat the pkg-config line
This is only needed once per package. Having it on every file makes the
build system ask about it n times, which is silly.
2013-11-14 00:23:04 +01:00
Carlos Martín Nieto b5b891a03d Packbuilder: adjust to changes in dev 2013-11-13 06:53:10 +01:00
Carlos Martín Nieto a33875f9c5 Packbuilder: compilation fixes
Don't name the return values, as they conflict with the names we want
inside and the types don't match what we want to have inside. We need
them to be two-way channels in the function, and then pass
unidirectional references to the different functions.
2013-06-17 01:55:36 +02:00
Vicent Martí 01d1a5c5d5 Merge pull request #24 from carlosmn/packbuilder-abort
Allow aborting the pack writing operation
2013-06-13 10:15:12 -07:00
Michael Crosby 6513377da0 Add nil for optional parameters for pack_write
The git_packbuilder_write function now takes
two optional arguments used for information
callbacks.  These are currently not needed
in the Go wrapper.
2013-06-07 19:08:10 -04:00
Carlos Martín Nieto b189d7919a Allow aborting the pack writing operation
In case of an error in the writer, the packbuilder will stay around
waiting for someone to read from its channel. The state associated
with a packbuilder is non-trivial and it will keep a reference to the
object, so the GC won't be able to free it.

Change the ForEach interface to also return a "stop" channel. Closing
the channel or writing into it will cause the first receive clause to
act, making the callback to return -1, aborting the operation and
ending the goroutine, freeing its hold on the packbuilder.
2013-05-23 11:44:06 +02:00
Axel Wagner 3a1bbbdf9d Correct some errors from 1da989e 2013-05-16 16:53:21 +02:00
Axel Wagner 1da989e28b 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.
2013-05-16 14:02:22 +02:00
Axel Wagner 140f362428 Add support for git_packbuilder 2013-05-16 13:56:07 +02:00