Commit Graph

41 Commits

Author SHA1 Message Date
lhchavez 37d110dbf0
Refactor all callbacks (#700) (#705)
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)
2020-12-05 17:10:18 -08:00
lhchavez 5f0640baed
Mark some symbols to be deprecated #minor (#698) (#702)
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 13:12:04 -08:00
github-actions[bot] 627f58d403
merge: Expose recursion limit merge option (#642) (#644)
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.

(cherry picked from commit 7e726fda6e)

Co-authored-by: Patrick Steinhardt <ps@pks.im>
2020-09-18 06:23:21 -07:00
Takuji Shimokawa aea6cff7ac Provide missing merge flags (#615)
This change adds two missing merge flags MergeTreeSkipREUC and MergeTreeNoRecursive.

(cherry picked from commit 33dac3d460)
2020-08-16 07:19:09 -07:00
lhchavez 75daa3227d Merge pull request #423 from josharian/more-annotated-commit
merge: add two missing AnnotatedCommit methods
(cherry picked from commit 21d618136f)
2020-08-16 07:19:09 -07:00
Carlos Martín Nieto 10ce505588 Merge pull request #425 from josharian/more-merge-file-flags
merge: add missing MergeFileFlag constants
(cherry picked from commit e319b9427f)
2020-08-16 07:19:09 -07:00
Carlos Martín Nieto 661e1a6f1b merge: expose the conflict marker size option 2018-02-22 09:46:42 +01: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