Commit Graph

81 Commits

Author SHA1 Message Date
lhchavez dcc9331226
Expose the ssh.PublicKey into the CertificateCheckCallback (#818)
This change exposes the raw SSH hostkey and the ssh.PublicKey into the
CertificateCheckCallback, so that callers can do better validations.
2021-09-05 19:00:59 -07:00
lhchavez 018647fd48 libgit2 v1.2.0 #major
This commit introduces libgit2 v1.2.0 to git2go, which brings a large
number of [bugfixes and
features](https://github.com/libgit2/libgit2/releases/tag/v1.2.0).

This also marks the start of the v32 release.
2021-09-05 18:52:01 -07:00
lhchavez 5def02a589 The big Callback type adjustment of 2020
This change makes all callbacks that can fail return an `error`. This
makes things a lot more idiomatic.
2021-09-05 18:52:01 -07:00
lhchavez 70e5e419cf
Add support for managed SSH transport #minor (#814)
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-05 17:04:40 -07:00
lhchavez b983e1daeb
Add support for managed HTTP/S transports (#810)
This change uses the newly-exposed Transport interface to use Go's
implementation of http.Client instead of httpclient via libgit2.
2021-09-05 16:39:07 -07:00
lhchavez f1fa96c7b7
Add support for custom smart transports (#806)
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-05 15:44:18 -07:00
lhchavez dbe032c347
Make all non-user-creatable structures non-comparable (#802)
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-09-05 13:59:36 -07:00
lhchavez 2077003fa5
Prepare for the v1.2.0 release (#796)
This change adds a few more deprecation messages just before we remove
them.
2021-09-04 14:14:47 -07:00
Byoungchan Lee 73d97b9bbe
Support git_remote_create_with_opts (#733)
Closes #645
2021-02-03 18:58:31 -08:00
lhchavez 10c67474a8
More callback refactoring (#713)
This change:

* Gets rid of the `.toC()` functions for Options objects, since they
  were redundant with the `populateXxxOptions()`.
* Adds support for `errorTarget` to the `RemoteOptions`, since they are
  used in the same stack for some functions (like `Fetch()`). Now for
  those cases, the error returned by the callback will be preserved
  as-is.
2020-12-10 07:19:41 -08:00
lhchavez e28cce87c7
Ensure that no pointer handles leak during the test (#712)
This change makes sure that pointer handles are correctly cleaned up
during tests.
2020-12-10 05:35:40 -08:00
lhchavez 5d8eaf7e65
Refactor all callbacks (#700)
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-05 13:13:59 -08:00
lhchavez 137c05e802
Mark some symbols to be deprecated #minor (#698)
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-12-05 07:23:44 -08:00
Hans Duedal 7497529f70
Expose GIT_CERT_SSH_SHA256 (#690)
Newer versions of libssh2 use SHA256 fingerprints
2020-11-26 17:32:24 -08:00
Suhaib Mujahid 5b6ce70b89
refactor: Use undeprecated options init (#656)
This PR move form linking against the deprecated `init_options` functions to the renamed `options_init` functions.

For more context see libgit2/libgit2@0b5ba0d744 and libgit2/libgit2@c6184f0c4b.
2020-10-22 06:18:11 -07:00
Jesse Hathaway b1cad11555
FetchOptions: add ability to specify ProxyOptions (#623)
Prior to this change you could not specifiy proxy options on the
FetchOptions struct, which made it impossible to specify a proxy for an
initial clone. This change adds the ProxyOptions to the FetchOptions
struct so you can go through a proxy when cloning.
2020-07-10 13:00:52 -07:00
Vladimir Buzuev 89dc80bbea clear native cred pointer after transfer ownership to libgit 2020-03-26 17:30:05 -07:00
Vladimir Buzuev 033ad6e5ef fix SIGSERV on double free for Cred object 2020-03-26 14:43:43 -07:00
lhchavez 37f732a833 Fix the Cred interface
This change adds Cred.Free() and finalizers to prevent memory leaks. It
also makes the interface for Cred more idiomatic and return actual
errors intead of ints.
2020-02-23 08:24:06 -08:00
lhchavez 22d400832b Fix build for go 1.9
This change makes the #includes between credentials.go and remote.go
consistent to avoid a build error in go 1.9.
2020-02-13 02:52:50 +00:00
Carlos Martín Nieto 544d29e18b remote: add keep-alive and references to the repository
Especially in 1.8, the garbage collector can decide to finalize an object even
as we are in one of its methods. This means it can free a remote while we're in
one of its calls, as we're referencing the pointer inside the object, rather
than the `Remote` itself.
2017-07-04 12:53:51 +02:00
Carlos Martín Nieto f037074198 Merge remote-tracking branch 'origin/next' 2017-01-20 00:46:34 +00:00
Mirko Nosenzo 717a47f754
Remote Rename Fix
Problem string array is returned if no error is occurred
2016-10-08 11:18:07 +02:00
Mirko Nosenzo c6b94a160e
Returning Problems on Remote Rename
Problems can be returned as string array on RemoteCollection Rename
2016-07-07 12:01:24 +02:00
Mirko Nosenzo 393098522c Remote Refinements
- Fixed credentialsCallback return value for missing callback
- Added Remote Rename
- Added Remote Disconnect
2016-05-29 14:59:17 +02:00
Carlos Martín Nieto 9163ca7d50 Update to 1dc4491 2016-04-23 15:35:22 +02:00
Carlos Martín Nieto 6d6736b2bd Merge remote-tracking branch 'upstream/master' into next 2016-02-15 15:02:19 +01:00
Jose Alvarez 92d736d12c Fix Fetch/Push memory allocation problems
The Fetch/Push operations didn't allocate the git_*_options structure
and this causes a memory problem in the libgit2 code. Following the
example of Clone operation, the Fetch/Push functions allocates the
options structure before calling the C.
2015-11-12 21:15:24 -05:00
Calin Seciu 367cd8eb9b Update libgit2 to 821131f
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-10-26 16:20:18 +02:00
Carlos Martín Nieto d5890f58e8 Run go fmt
As it seems to be something that many people can't get over, reformat
all the files; as we're breaking things, whoever depended on 'next' will
have to take many changes into account anyway, so let's include this to
reduce the noise of incoming patches.
2015-08-31 20:22:17 +02:00
Aaron O'Mullan 803ef7dad5 Add nil check on CredentialsCallback wrapper 2015-08-31 12:48:11 +02:00
Aaron O'Mullan a572b15df6 Add back support for RemoteCallbacks in Remote.Push() 2015-08-31 12:43:36 +02:00
Carlos Martín Nieto b4ade2b9c6 Merge remote-tracking branch 'upstream/master' into next 2015-07-01 16:07:02 +02:00
Carlos Martín Nieto 2475907105 Merge commit 'refs/pull/174/head' of github.com:libgit2/git2go 2015-07-01 15:56:06 +02:00
Carlos Martín Nieto e50203a253 Merge remote-tracking branch 'upstream/master' into next
Conflicts:
	branch.go
2015-06-28 01:32:13 +02:00
Carlos Martín Nieto 4b9cbd78fd Create a RemoteCollection for managing remotes
Instead of making the 'Remote' part of the function calls, create a
collection object which serves to namespace the operations for the
remotes.
2015-06-28 00:51:17 +02:00
Carlos Martín Nieto ba0a24087a Get rid of Owner() on Remote and Submdoule
These are inherently unsafe. The underlying pointer might get released
at any moment.
2015-06-28 00:49:56 +02:00
Carlos Martín Nieto d400f1d5b2 Update to libgit2 fa39975 2015-06-28 00:34:54 +02:00
Carlos Martín Nieto c00a05586b Make the network code use handles
This wasn't ported together with the rest, but it does exhibit the same
issues, so let's port it over now.
2015-06-10 13:37:59 +02:00
Carlos Martín Nieto 36e0a256fe Update to libgit2 b6011e29 2015-06-08 04:11:21 +02:00
Carlos Martín Nieto c4fce1a218 Update to libgit2 d675982a153
There's been some changes to the checkout strategy, especially the
SAFE_CREATE mode, which is now the RECREATE_MISSING flag, though that
shouldn't be necessary to use in the general case.

The largest changes come from the removal of the signture from
ref-modifying functions/methods and the removal of the reflog string in
all but those directly related to moving references.
2015-03-15 01:49:32 +01:00
Mark Probst e439b931a6 Default signature 2015-03-04 15:52:57 -08:00
Matthew Donoughe 51e7cf0ad4 use git_signature_free 2015-02-13 20:44:29 -05:00
David Calavera dbddb88a8c Add prune methods to Remote. 2015-01-05 11:58:36 -08:00
Carlos Martín Nieto d57246fb74 Update to libgit2 master
This gets rid of the Push object. All network now goes through the
Remote object.
2015-01-04 17:05:11 +00:00
Carlos Martín Nieto 0202f152ac Add the new callbacks for Remote.Push()
This unifies the types with the Push struct, in preparation for its
deletion.
2014-12-13 01:23:40 +01:00
Carlos Martín Nieto 63116ea57e Update to master
This deprecates the Push struct in favour of Remote.Push()
2014-12-13 00:25:11 +01:00
Carlos Martín Nieto 520a0425c7 Add the newer missing thread-locking instances 2014-12-06 03:03:26 +01:00
Carlos Martín Nieto 8c631b0c25 Add missing thread locking 2014-12-06 02:45:26 +01:00
Carlos Martín Nieto 27ce026f1c Merge pull request #140 from AaronO/patch-1
Add wrapper for git_remote_delete : Repository.DeleteRemote
2014-12-06 02:25:02 +01:00