summaryrefslogtreecommitdiff
path: root/git.go
AgeCommit message (Collapse)Author
2021-11-08Generate stringer files automatically (#841)Kirill
Added `stringer` annotations to `git.go` for `ErrorClass` and `ErrorCode`. Added `generate` rule for `Makefile` to generate string representations for these types (first building cgo files in `_obj` dir to get C constants). Finally, updated `ci` actions workflow to check that generated files are up to date. Fixes: #543
2021-09-05Make all Options objects consistentlhchavez
This change makes all Options objects have child Option fields as values (instead of pointers) to mirror the libgit2 interface. It also names them Options instead of Opts to match the current libgit2 nomenclature and removes the Version fields.
2021-09-05Add support for managed SSH transport #minor (#814)lhchavez
This change drops the (hard) dependency on libssh2 and instead uses Go's implementation of SSH when libgit2 is not built with it.
2021-09-05Add support for managed HTTP/S transports (#810)lhchavez
This change uses the newly-exposed Transport interface to use Go's implementation of http.Client instead of httpclient via libgit2.
2021-09-05Add support for custom smart transports (#806)lhchavez
This change adds support for git smart transports. This will be then used to implement http, https, and ssh transports that don't rely on the libgit2 library.
2021-09-05Make all non-user-creatable structures non-comparable (#802)lhchavez
This change makes all non-user-creatable structures non-comparable. This makes it easier to add changes later that don't introduce breaking changes from the go compatibility guarantees perspective. This, of course, implies that this change _is_ a breaking change, but since these structures are not intended to be created by users (or de-referenced), it should be okay.
2021-02-15fix: Use `err` instead of error as a variable name for errors (#746)Suhaib Mujahid
fix #745
2020-12-05Refactor all callbacks (#700)lhchavez
This change is a preparation for another change that makes all callback types return a Go error instead of an error code / an integer. That is going to make make things a lot more idiomatic. The reason this change is split is threefold: a) This change is mostly mechanical and should contain no semantic changes. b) This change is backwards-compatible (in the Go API compatibility sense of the word), and thus can be backported to all other releases. c) It makes the other change a bit smaller and more focused on just one thing. Concretely, this change makes all callbacks populate a Go error when they fail. If the callback is invoked from the same stack as the function to which it was passed (e.g. for `Tree.Walk`), it will preserve the error object directly into a struct that also holds the callback function. Otherwise if the callback is pased to one func and will be invoked when run from another one (e.g. for `Repository.InitRebase`), the error string is saved into the libgit2 thread-local storage and then re-created as a `GitError`.
2020-12-05Mark some symbols to be deprecated #minor (#698)lhchavez
This change introduces the file deprecated.go, which contains any constants, functions, and types that are slated to be deprecated in the next major release. These symbols are deprecated because they refer to old spellings in pre-1.0 libgit2. This also makes the build be done with the `-DDEPRECATE_HARD` flag to avoid regressions. This, together with [gorelease](https://godoc.org/golang.org/x/exp/cmd/gorelease)[1] should make releases safer going forward. 1: More information about how that works at https://go.googlesource.com/exp/+/refs/heads/master/apidiff/README.md
2020-10-23apply: Add bindings for git_apply_to_tree (#657)Sami Hiltunen
Adds bindings to the git_apply_to_tree function that allows applying a diff directly to a tree.
2020-09-29Add a ReInit function (#647)Jesse Hathaway
libgit2 stores the lookup paths for gitconfig files in its global state. This means that after a program changes its effective uid libgit2 will still look for gitconfig files in the home directory of the original uid. Expose a way to call C.git_libgit2_init so a user can reinitialize the libgit2 global state.
2020-06-21Add a way to cleanly shut down the library (#578)lhchavez
This change adds the Shutdown() method, so that the library can be cleanly shut down. This helps significanly reduce the amount of noise in the leak detector.
2020-02-27Resolves issue #541 - typo in error code 'ErrAmbigious'Jonathan Simms
I've added an additional constant with the correct spelling. I did this rather than removing the existing constant to avoid breaking existing code with the misspelled name.
2019-01-03Merge pull request #432 from josharian/simplify-oidCarlos Martín Nieto
git: simplify some Oid methods
2018-08-08Remove uses of deprecated git_buf_freeCarlos Martín Nieto
2018-02-15git: simplify some Oid methodsJosh Bleecher Snyder
2017-07-08Second round of keep-alivesCarlos Martín Nieto
2017-04-14Allow building statically via the "static" build tagCarlos Martín Nieto
2017-04-13Merge pull request #332 from ezwiebel/rebase-wrapperCarlos Martín Nieto
Rebase wrapper
2016-11-19Update to 0.25-rc1Carlos Martín Nieto
2016-11-01Took @carlosmn PR review into accountezwiebel
2016-11-01Get rid of the with-static.sh scriptCarlos Martín Nieto
CGO can perform variable substitution in the directives, so we don't need to use a script to set up the variables; we can let the go tool do it for us.
2016-10-31Panic if libgit2 is not thread-awareCarlos Martín Nieto
Go calling C is inherently multi-threaded. If libgit2 cannot handle threading, then we're going to crash at some random point. Crash right at the start so we know what's happening.
2016-08-27Also remove a pkg-config directive that snuck inCarlos Martín Nieto
2016-04-27Error out if we detect an incompatible libgit2 versionCarlos Martín Nieto
The master version supports only v0.24 so let's enforce that via the compiler.
2016-03-07Merge branch 'next'Carlos Martín Nieto
2015-10-26Update libgit2 to 821131fCalin Seciu
The API changes are: - `*Remote.Connect` ```go // from: func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks) error // to: func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks, headers []string) error ``` - `*Remote.ConnectFetch` - `headers` was added as above - `*Remote.ConnectPush` - `headers` was added as above
2015-08-31Merge branch 'next'Carlos Martín Nieto
2015-06-28Merge remote-tracking branch 'upstream/master' into nextCarlos Martín Nieto
Conflicts: branch.go
2015-06-08Update to libgit2 b6011e29Carlos Martín Nieto
2015-06-08Merge remote-tracking branch 'origin/master' into nextCarlos Martín Nieto
2015-06-07Add error code matching GIT_EAUTH for authentication failuresMike Edgar
2015-05-22Introduce an indirection layer for pointersCarlos Martín Nieto
As the Go runtime can move stacks at any point and the C code runs concurrently with the rest of the system, we cannot assume that the payloads we give to the C code will stay valid for any particular duration. We must therefore give the C code handles which we can then look up in our own list when the callbacks get called.
2015-01-14Link dynamically to libgit2Carlos Martín Nieto
With libgit2 v0.22 released, we can expect its API and ABI to remain stable when installed on the system. Linking dynamically allows us to use the go tool alone to build and install the package.
2015-01-04Update to libgit2 masterCarlos Martín Nieto
This gets rid of the Push object. All network now goes through the Remote object.
2014-12-31Revert "Make the cgo tool do more linking work"Carlos Martín Nieto
2014-12-27Make the cgo tool do more linking workCarlos Martín Nieto
The cgo directives let us do a lot more than I previously thought, so we can use this to make the building process of git2go go through the go tool directly rather than via the script. libgit2 still needs to be built manually, so we do still require make, but only for building libgit2. Once that's built, any modifications to git2go's own code can be built with go build
2014-12-11Remove useless includesCarlos Martín Nieto
2014-12-03Update to masterCarlos Martín Nieto
2014-10-28Make the constants have typesCarlos Martín Nieto
While Go will assign the correct type to a const block when it auto-creates the values, assigning makes the const be typeless and will only gain it in each particular use. Make each constant in the blocks have an assigned type.
2014-06-07Really build staticallyCarlos Martín Nieto
2014-06-03Switch default to static linkingCarlos Martín Nieto
Build in libgit2 statically into git2go by default, removing the need for the right version to be available as a shared object. We do still need to link dynamically against OpenSSL and LibSSH2.
2014-04-26Merge commit 'refs/pull/72/head' of github.com:libgit2/git2goCarlos Martín Nieto
Conflicts: git.go wrapper.c
2014-04-04Merge remote-tracking branch 'libgit/master' into add-basic-diff-patchJesse Ezell
2014-04-04adjust comments on error messages to standard godoc styleJesse Ezell
2014-04-02make it possible to handle errorsJesse Ezell
2014-03-25Add a settings packageCarlos Martín Nieto
This lets us modify the libgit2-wide options/settings.
2014-03-20merge with latestJesse Ezell
2014-03-20cleanup and refactor diff / patchJesse Ezell
2014-03-19Oid: fix IsZero()Carlos Martín Nieto
We need to compare against the number zero, not its ASCII value.