Commit Graph

54 Commits

Author SHA1 Message Date
github-actions[bot] 781e820fca
Add support for custom smart transports (#806) (#807)
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.

(cherry picked from commit f1fa96c7b7)

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2021-09-05 16:00:10 -07:00
github-actions[bot] d21ba51f4e
More callback refactoring (#713) (#717)
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.

(cherry picked from commit 10c67474a8)

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2020-12-10 18:01:41 -08:00
lhchavez e57ff6c391 Add `NewCredentialSSHKeyFromSigner` (#706)
This change adds `NewCredentialSSHKeyFromSigner`, which allows idiomatic
use of SSH keys from Go. This also lets us spin off an SSH server in the
tests.

(cherry picked from commit abf02bc7d7)
2020-12-06 12:39:08 -08:00
github-actions[bot] b7d6ab837c
Refactor all callbacks (#700) (#703)
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`.

(cherry picked from commit 5d8eaf7e65)

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2020-12-05 16:23:04 -08:00
github-actions[bot] a54915d90b
Mark some symbols to be deprecated #minor (#698) (#699)
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
(cherry picked from commit 137c05e802)
2020-12-05 11:43:02 -08:00
michael boulton 7d4453198b
Add support for creating signed commits and signing commits during a rebase (#626) 2020-08-18 09:25:31 -07:00
michael boulton 7883ec85de
More diff functionality (#629)
This PR adds

- The ability to apply a Diff object to the repo
- Support for git_apply_hunk_cb and git_apply_delta_cb callbacks in options for applying the diffs
- The ability to import a diff from a raw buffer (for example, one exported by ToBuf) into a Diff object associated with the repo
- Tests for the above
2020-08-18 06:14:02 -07:00
lhchavez 05bc5e36ff Add support for indexers and alternate odb packfiles
This allows for implementations of git servers written in Go.
2020-02-23 09:13:47 -08:00
Carlos Martín Nieto c5159e624e credentials: unconfuse Go about the type
For some reason cgo thinks the `credtype` field does not exist in `git_cred` so
let's put it into the C code.
2019-12-10 22:33:00 +00:00
Carlos Martín Nieto f037074198 Merge remote-tracking branch 'origin/next' 2017-01-20 00:46:34 +00:00
Mirko Nosenzo 278dc9ac4f Checkout Callbacks
- Added CheckoutNotifyType mapping git_checkout_notify_t
- Added CheckoutOpts.NotifyFlags of type CheckoutNotifyType
- Added CheckoutNotifyCallback mapping git_checkout_notify_cb
- Added CheckoutProgressCallback mapping git_checkout_progress_cb
2016-05-29 13:44:18 +02:00
Carlos Martín Nieto 9163ca7d50 Update to 1dc4491 2016-04-23 15:35:22 +02:00
Calin Seciu c6f394e407 Merge branch 'next' into stash-support 2016-02-20 14:52:57 +02:00
Ian Lance Taylor a1f25eafec handles, merge: simplify code, don't copy file contents 2016-02-16 21:34:43 -08:00
Calin Seciu d54ea1d6a8 Add stash support 2015-09-21 14:50:57 +03:00
Carlos Martín Nieto f72db33baf Merge branch 'next' 2015-08-31 13:55:46 +02:00
Patrick Steinhardt 0b530c15cf clone: improve handling of remote create callback
The clone options contain fields for ae remote create callback
and its payload, which can be used to override the behavior when
the default remote is being created for newly cloned
repositories.

Currently we only accept a C function as callback, though, making
it overly complicated to use it. We also unconditionally `free`
the payload if its address is non-`nil`, which may cause the
program to segfault when the memory is not dynamically allocated.

Instead, we want callers to provide a Go function that is
subsequently being called by us. To do this, we introduce an
indirection such that we are able to extract the provided
function and payload when being called by `git_clone` and handle
the return values of the user-provided function.
2015-08-18 14:01:51 +02:00
Calin Seciu 6c4af98c5b Add more support for tags
Implement support for the following libgit2 functions:

- 'git_tag_list' and 'git_tag_list_match'
- 'git_tag_foreach'
- 'git_tag_create_lightweight'
2015-07-31 10:07:26 +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 e066d24efb Add DiffBlobs
This lets you diff two arbitrary blobs with arbitrary names.
2015-06-29 21:29:47 +02:00
Carlos Martín Nieto d400f1d5b2 Update to libgit2 fa39975 2015-06-28 00:34:54 +02: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 74957c2ae6 Add missing return type 2014-12-18 23:02:53 +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
Lucas Clemente 9d37f81764 implemented Index.AddAll, Index.RemoveAll, Index.UpdateAll 2014-10-24 21:55:08 +02:00
Carlos Martín Nieto 17a9214307 Update to libgit2 master
The option to ignore the server's certificate has been removed, replaced
witha  callback for the user to perform their own checking.

Remote.Fetch() now performs opportunistic updates and takes a list of
refspecs to use as the active set for a particular fetch.
2014-10-15 15:56:59 +02:00
Ben Navetta 33ae83f4d9 remove status_foreach binding 2014-08-25 18:15:36 -04:00
Ben Navetta 1cb654e4f2 add git_status_foreach binding 2014-08-19 08:51:18 -04:00
Carlos Martín Nieto 5809f03108 Merge commit 'refs/pull/72/head' of github.com:libgit2/git2go
Conflicts:
	git.go
	wrapper.c
2014-04-26 20:51:21 +02:00
Carlos Martín Nieto 4df7eb516c Merge pull request #63 from jezell/jezell/merge
Merge functions (in progress)
2014-04-26 20:42:18 +02:00
Carlos Martín Nieto 57f14a2591 Merge commit 'refs/pull/48/head' of github.com:libgit2/git2go 2014-04-26 20:30:57 +02:00
Carlos Martín Nieto b3a160b0f8 Adjust to libgit2 dev changes
This fixes #87
2014-04-26 18:43:22 +02:00
Aidan Nulman d9f4adff6c Merge branch 'master' into custom_odb
Conflicts:
	odb.go
	wrapper.c
2014-04-03 16:41:43 -04:00
Jesse Ezell 85420f2002 Merge branch 'master' of http://github.com/libgit2/git2go into merge 2014-03-26 11:18:21 -07:00
Jesse Ezell 155f641683 don't expose 3 different diff foreach methods. use structures instead of pointers to structures for diff detail. add patch error code handling. trim excess data from diff structures. 2014-03-21 22:51:38 -07:00
Jesse Ezell d78036fe24 refactor and cleanup code 2014-03-20 22:54:18 -07:00
Jesse Ezell 37964e878f merge with latest 2014-03-20 22:02:19 -07:00
Jesse Ezell 51aa76d6f7 remove strarray wrappers 2014-03-11 16:25:22 -07:00
Jesse Ezell d560b9e9bd cleanup clone code 2014-03-11 13:19:12 -07:00
Jesse Ezell 634acbe498 merge with latest 2014-03-11 12:55:57 -07:00
Jesse Ezell f1e889928a merge with latest, replace merge wrappers with go code 2014-03-11 12:29:40 -07:00
Jesse Ezell 5e163fa2e8 add blob chunk creation, creation of tree builders for specific trees, minor API cleanup 2014-03-07 16:43:20 -08:00
Jesse Ezell 9e7ba02708 wrap merge functions 2014-02-28 01:06:41 -08:00
Jesse Ezell 374e2112df add push, refine remotes 2014-02-27 16:36:44 -08:00
Aidan Nulman decaf064f9 add custom refdb backend support 2014-02-24 03:01:47 -05:00
lye bc80beb843 Add partial diff/patch functionality.
This commit adds barebones capacity to generate diffs from two trees and
to emit those as git-style diffs (via `Patch.String`), or to enumerate
the files/hunks/lines in the diff to emit the data yourself.

The walk functions have been implemented in the same manner as the Odb
walking methods.

Note that not all of the functionality is implemented for either the
`git_diff_*` nor the `git_patch_*` functions, and there are unexposed
constants which would likely be useful to add.
2014-02-20 00:29:03 -06:00
Aidan Nulman 1c23e8ece3 add OdbBackend.Free() and the C it wraps; go fmt odb.go 2014-01-29 18:55:17 -05:00
Jason Toffaletti 32bf5f0a23 wip wrapping git_remote 2014-01-06 20:05:35 +00:00
Jason Toffaletti d124544668 minor 2014-01-06 16:55:29 +00:00
Jason Toffaletti e825d66fba work in progress wrapping git_clone 2014-01-04 00:40:21 +00:00