Commit Graph

49 Commits

Author SHA1 Message Date
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 698ddfb4ac
Support more MergeBase functions (#720)
This change adds support for MergeBaseMany, MergeBasesMany, and
MergeBaseOctopus.
2020-12-13 10:35:34 -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 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
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
Patrick Steinhardt 7e726fda6e
merge: Expose recursion limit merge option (#642)
The `recursion_limit` merge option provided by libgit2 is currently not
exposed and thus inaccessible to Git2Go users. Let's expose it to let
users control creation of recursive merge bases.
2020-09-18 05:43:56 -07:00
Takuji Shimokawa 33dac3d460
Provide missing merge flags (#615)
This change adds two missing merge flags MergeTreeSkipREUC and MergeTreeNoRecursive.
2020-06-04 20:34:37 -07:00
lhchavez a140f2310f Add test and runtime.KeepAlive() 2020-02-23 14:58:21 +00:00
lhchavez 627447092f Merge remote-tracking branch 'upstream/master' into more-annotated-commit 2020-02-23 14:49:04 +00:00
Carlos Martín Nieto 97e6392d3a Adjust to libgit2 changes 2019-12-10 22:15:32 +00:00
Carlos Martín Nieto e319b9427f
Merge pull request #425 from josharian/more-merge-file-flags
merge: add missing MergeFileFlag constants
2019-01-02 23:58:19 +01:00
Carlos Martín Nieto 661e1a6f1b merge: expose the conflict marker size option 2018-02-22 09:46:42 +01:00
Josh Bleecher Snyder 9de57cc90e merge: add missing MergeFileFlag constants
While we're here, pull in comments as well.
While one can pop back and forth between godoc and libgit2 refs,
it's much nicer to have it in one place.

Note that MergeFileStyleSimplifyAlnum probably should have been called
merely MergeFileSimplifyAlnum (no "Style"). It's probably not worth
breaking backwards compatibility to fix it, but we avoid the mistake
going forwards.
2018-01-25 16:55:42 -08:00
Josh Bleecher Snyder 03339f731a merge: add two missing AnnotatedCommit methods 2018-01-25 16:00:39 -08:00
Carlos Martín Nieto 55a1096141 Third round of keep-alive aditions 2017-07-08 16:07:51 +02:00
Carlos Martín Nieto ac719c6759 Merge branch 'master' into next 2016-02-18 15:57:46 +01:00
Han-Wen Nienhuys aa59dccea7 Upgrade to libgit2 to 0f9d15493d5d8ad4353dd7beed52c9567334f6e5 2016-02-17 18:23:52 +01:00
Ian Lance Taylor ddbf1baab1 merge: remove whitespace change 2016-02-16 21:36:57 -08:00
Ian Lance Taylor a1f25eafec handles, merge: simplify code, don't copy file contents 2016-02-16 21:34:43 -08:00
Carlos Martín Nieto 6d6736b2bd Merge remote-tracking branch 'upstream/master' into next 2016-02-15 15:02:19 +01:00
Ian Lance Taylor 42b11d403d handles, merge, odb: changes for Go 1.6 pointer passing rules
See http://tip.golang.org/cmd/cgo/#hdr-Passing_pointers .
2016-01-07 18:37:46 -08:00
Carlos Martín Nieto 3b5633de21 Mention that MergeAnalysis is a bitmask 2015-10-26 21:22:22 +01: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 0522886781 Merge remote-tracking branch 'origin/master' into next 2015-09-18 10:52:37 +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
Carlos Martín Nieto f72db33baf Merge branch 'next' 2015-08-31 13:55:46 +02:00
Patrick Steinhardt 37bb1a6025 merge: fix memory leak related to merge file opts 2015-08-12 10:24:59 +02:00
Carlos Martín Nieto 47949510f1 Merge remote-tracking branch 'origin/master' into next 2015-08-04 14:59:10 +02:00
Carlos Martín Nieto efd61a4bc0 Wrap MergeBases
While here, test MergeBase as well.
2015-07-31 11:37:18 +02:00
Carlos Martín Nieto b374e16db8 Update to libgit2 4c02d3937 2015-04-18 04:50:39 +02:00
joseferminj 92a1f92d91 Add TargetDirectory field to Checkout options.
TargetDirectory field indicates a alternative checkout path to workdir.
2015-01-29 15:17:46 +01:00
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 1d759e3697 Update to master 2014-12-03 17:26:55 +01:00
joseferminj ff65faa082 Fix MergeTrees func to accept nil as ancestor parameter 2014-11-08 19:07:21 -05:00
Carlos Martín Nieto 668aa5dae1 Make the constants have types
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-10-28 11:29:31 +01:00
Carlos Martín Nieto 7906bdbdce Merge: merge analysis now returns the user's preference 2014-05-31 16:47:35 +02:00
Jesse Ezell 9d8cbe7547 use cast_ptr instead of ptr for travis go tip build 2014-04-04 00:47:21 -07:00
Jesse Ezell 864c57f554 merge latest, copy merge bytes to go array 2014-04-04 00:22:42 -07:00
Jesse Ezell 0b48ba2224 Merge analysis and merge file 2014-03-26 14:42:01 -07:00
Jesse Ezell eff3a8b4d0 support nil merge options 2014-03-26 12:17:23 -07:00
Jesse Ezell 50a3c4aa09 update to new merge API 2014-03-26 11:28:48 -07:00
Jesse Ezell 6a068d5265 remove useless wrappers 2014-03-11 12:47:56 -07:00
Jesse Ezell e5946d4009 Add defaults, add simple test, merge heads should be pointer array 2014-02-28 14:33:38 -08:00
Jesse Ezell 6af4d4a825 move finalizer above free 2014-02-28 11:15:39 -08:00
Jesse Ezell da64faf8bd switch from iota to explicit def 2014-02-28 11:13:51 -08:00
Jesse Ezell 5f5906878e merge options / merge tree options 2014-02-28 01:31:01 -08:00
Jesse Ezell 9e7ba02708 wrap merge functions 2014-02-28 01:06:41 -08:00