Commit Graph

21 Commits

Author SHA1 Message Date
Carlos Martín Nieto 0bb73e43a8 Oid: use Go's conversion functions
Go already has all the necessary pieces for encoding and decoding hex
strings. Using them let's us avoid going into C land.

Benchmarks show this takes about half the time as using libgit2's
functions.
2014-03-19 03:57:36 +01:00
Carlos Martín Nieto c243c31f7d Oid: remove Bytes()
This is not needed. We can do id[:] to get a slice.
2014-03-19 03:56:50 +01:00
Carlos Martín Nieto c9c7c1e779 Oid: make NewOid take a string
This is the most common way of having an id that's not in Oid form, so
let's make it the "default" and rename to NewOidFromBytes() the one that
takes []byte.
2014-03-19 03:56:50 +01:00
Carlos Martín Nieto b6703d4767 Oid: make the type directly [20]byte
There is no need for a struct with a single field. An Oid is 20 bytes
which hold the binary representation of the hash, so let's use that
directly. Go lets us have methods on this new type just the same.
2014-03-19 03:56:50 +01:00
Jesse Ezell e2db9b16cd merge latest, cleanup error handling, add thread locks 2014-02-26 10:41:20 -08:00
Jesper Hansen 499f52a354 Added git error code to the error object. 2014-02-26 16:10:00 +01:00
Carlos Martín Nieto 1b09b03c0e Merge commit 'refs/pull/53/head' of github.com:libgit2/git2go
On top: fix git_buf handling and rename signature

This fixes #57, #54.

Conflicts:
	git.go
	reference.go
	repository.go
	submodule.go
2014-02-23 15:31:22 +01:00
Aidan Nulman f66502aaf4 update git2go to support latest libgit2 development commit (id: 66af84) 2014-01-29 18:01:26 -05:00
Jason Toffaletti e825d66fba work in progress wrapping git_clone 2014-01-04 00:40:21 +00: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 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í 09424744a1 Merge pull request #25 from carlosmn/error-nil
Catch nil error instances
2013-06-13 10:14:31 -07:00
Vicent Martí 7823b14266 Merge pull request #26 from carlosmn/ref-iter
Implement a reference iterator
2013-06-13 10:14:09 -07:00
Carlos Martín Nieto 931f187301 Implement a reference iterator
Wrap the reference iterators, and provide a Iter() function to get
them through a channel.
2013-05-23 11:13:42 +02:00
Axel Wagner 535a178afa Implement ShortenOids 2013-05-21 23:03:11 +02:00
Carlos Martín Nieto d824ea415d Catch nil error instances
Unfortunately libgit2 sometimes returns an error without setting an
error message. Provide an alternative message instead of trying to
dereference nil.
2013-05-21 11:51:31 +02:00
Axel Wagner 420cf7f0a6 Use cbool-helper in Discover() 2013-05-17 01:02:33 +02:00
Axel Wagner e1238b5994 Implement git_repository_discover 2013-05-14 21:35:58 +02:00
Axel Wagner f1848e48b8 Implement most of the oid_-functions as Methods 2013-04-26 21:12:27 +02:00
Carlos Martín Nieto 62a16395b1 Oid: make sure not to dereference a NULL git_oid
Some calls like Reference.Target() can return NULL if the reference is
symbolic. Make sure newOidFromC() can handle these situations.
2013-03-08 16:03:49 +01:00
Vicent Marti b1d50b70ea Initial commit 2013-03-05 20:53:04 +01:00