Commit Graph

938 Commits

Author SHA1 Message Date
lhchavez d48f93d653 Merge branch 'master', remote-tracking branch 'origin' into feature-diff-extra 2020-08-18 05:49:04 -07:00
Michael Boulton 05a41f164c
Move os thread lock to outer scope in defaultapplyoptions 2020-08-18 08:16:29 +01:00
Michael Boulton 633f7639db
Hardcode version in apply options which should never change 2020-08-18 08:14:20 +01:00
Michael Boulton 6dc7641069
Make apply callback types have more conssitent names 2020-08-18 08:11:15 +01:00
Michael Boulton 37e56c28a8
Remove C wrapper for initialising apply opptions 2020-08-17 08:36:12 +01:00
michael boulton d1d3dccd8a
Update diff_test.go
Make test naming consistent

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2020-08-17 08:21:39 +01:00
Michael Boulton 7f3d112fbe
Make it possible to use a git2go error as a return value from a diff callback and have it propagate 2020-08-17 08:20:41 +01:00
Michael Boulton fff6c9d8ae
Store pointer to apply options instead of copying the struct 2020-08-17 08:17:58 +01:00
Michael Boulton d8f155f971
Convert diff contents to CBuffer and free it instead of using a CString 2020-08-17 08:15:56 +01:00
michael boulton 2edef4dbea
Update wrapper.c
Fix spaces->tabs

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2020-08-17 08:08:06 +01:00
Michael Boulton 97267d3f6e
Remove uneeded locking of os thread in calling local C function 2020-08-17 08:07:06 +01:00
Michael Boulton 067989fe99
Fix some missing keepalives 2020-08-17 08:05:44 +01:00
Michael Boulton ad65e109e4
Do not embed callbacks in struct and give them more appropriate type names 2020-08-17 08:02:18 +01:00
lhchavez 2ac9f4e69b
Add two more GitHub Actions workflows (#633)
This change adds:

* `tag.yml`: Creates a new tag every time the master or a release branch
  is pushed.
* `backport.yml`: Creates a cherry-pick in older release branches to
  keep them up to date with little cost.
2020-08-16 07:27:17 -07:00
lhchavez bbaf9746f9 Add two more GitHub Actions workflows
This change adds:

* `tag.yml`: Creates a new tag every time the master or a release branch
  is pushed.
* `backport.yml`: Creates a cherry-pick in older release branches to
  keep them up to date with little cost.
2020-08-16 06:53:23 -07:00
lhchavez 5314951759
Refresh the GitHub Actions CI (#632)
This change:

* Builds the library with Go 1.14, too.
* Builds the non-legacy tests with Ubuntu Focal (20.04).
* Adds testing for system-wide libraries, both static and dynamic
  versions.
* Fixes a typo in the README.
2020-08-15 17:19:53 -07:00
michael boulton fc6eaf3638
Fix null pointer dereference in status.ByIndex (#628)
`git_status_byindex` can return a null pointer if there is no statuses.
2020-08-14 11:19:21 -07:00
Michael Boulton 87433ff8a8
Remove changed fixed in other branch 2020-08-14 11:12:33 +01:00
Michael Boulton 315a4855f1
Add more tests and deduplicate some test code 2020-08-14 10:54:58 +01:00
Michael Boulton adfb859419
Fix nuill pointer dereference 2020-08-14 10:27:32 +01:00
Michael Boulton c5985ee1a3
fix tests 2020-08-14 10:27:20 +01:00
Michael Boulton 887d2d9eeb
Fix missing extern 2020-08-14 09:18:48 +01:00
Michael Boulton 1352980b36
Add support for callback on hunks/apply 2020-08-14 09:17:13 +01:00
Michael Boulton 9bbbbb4a52
Fix missing func 2020-08-14 08:36:40 +01:00
Michael Boulton de24abbdae
Add functionality for converting Diff objects to a buffer and back 2020-08-14 08:30:14 +01:00
Yuichi Watanabe 462ebd83e0
Add support for git_blob_is_binary (#625)
This adds IsBinary() func to Blob struct, which simply returns the result of git_blob_is_binary function.
Refs: https://libgit2.org/libgit2/#HEAD/group/blob/git_blob_is_binary
Issue: Add support for git_blob_is_binary #426

Fixes: #426
2020-07-30 05:07:05 -07:00
Patrick Steinhardt d8f9990d4d
Fix installation of libgit2 into wrong libdir (#624)
Upstream libgit2 has migrated to use the GNUInstallDirs module to decide
where things will be installed to by default. While it improves
consistency with the host system, we're not really after that when
building the vendored libgit2 library, and in fact libgit2.{a,pc} may
now be installed into a different directory than before as it started to
depend on the host platform.

Fix this by explicitly specifying that we want the library and pkgconfig
file to be installed into a plain "lib/" directory.
2020-07-25 13:08:04 -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
lhchavez 20a55cdf92
Revamp the ways in which the library can be built (#621)
This change allows to link the system version of libgit2 statically.
Since `-tags static` is already used for the bundled version of the
library and to avoid breaking old workflows, `-tags
static,system_libgit2` is now used to select that.

This means that the valid combinations are:

| Flag                          | Effect                                        |
|-------------------------------|-----------------------------------------------|
| _No flags_                    | Dynamically-linked against the system libgit2 |
| `-tags static,system_libgit2` | Statically-linked against the system libgit2  |
| `-tags static`                | Statically-linked against the bundled libgit2 |

Note that there is no way to express dynamically linking against the
bundled libgit2 because that makes very little sense, since the binaries
wouldn't be able to be distributed. If that's still desired, the
`PKG_CONFIG_PATH` environment variable can set before building the code.
[`Makefile`](https://github.com/libgit2/git2go/blob/master/Makefile) has
an example of how it is used in the CI.
2020-06-21 15:40:52 -07:00
lhchavez c78ae57de6
Fix a potential use-after-free in DiffNotifyCallback (#579)
This change makes the DiffNotifyCallback always use an "unowned"
*git.Diff that does _not_ run the finalizer. Since the underlying
git_diff object is still owned by libgit2, we shouldn't be calling
Diff.Free() on it, even by accident, since that would cause a whole lot
of undefined behavior.

Now instead of storing a reference to a *git.Diff in the intermediate
state while the diff operation is being done, create a brand new
*git.Diff for every callback invocation, and only create a fully-owned
*git.Diff when the diff operation is done and the ownership is
transfered to Go.
2020-06-21 06:45:39 -07:00
lhchavez 619a9c236b
Add a way to cleanly shut down the library (#578)
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-06-21 06:44:06 -07:00
lhchavez 9eaf4fed5f
Update the `README.md` to clarify some aspects of static libgit2 (#620)
This change improves the documentation surrounding libgit2 static builds
and modules.

Fixes: #618
2020-06-20 16:24:46 -07:00
lhchavez 1c9bef0f9f
Remove a couple of now-unnecessary CMake defines (#619)
This change removes the `LIB_INSTALL_DIR` and `INCLUDE_INSTALL_DIR` from
the `script/build-libgit2.sh` script, since they are now unneeded and
just print a warning if they are used.
2020-06-20 12:39:03 -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
Jesse Hathaway 5241c72e6e
Add support for parsing git trailers (#614)
Adds a wrapper for git_message_trailers which returns a slice of trailer
structs.
2020-06-02 10:30:42 -07:00
lhchavez 31f877e249
Merge pull request #582 from suhaibmujahid/method-rename
It is not Go idiomatic to put Get into the getter's name
2020-05-09 20:39:51 -07:00
Suhaib Mujahid cf6522c7fe refactor: Rename methods with Get prefix
It is not Go idiomatic to put Get into the getter's name.

https: //golang.org/doc/effective_go.html#Getters
Co-Authored-By: lhchavez <lhchavez@users.noreply.github.com>
2020-05-09 23:32:17 -04:00
lhchavez 8b51d0db8e
expose options related to caching 2020-05-04 17:44:13 -07:00
Vladimir Buzuev 862cde393c cache_opts: address PR comments 2020-05-04 11:01:38 -07:00
Suhaib Mujahid 91d08450b6 Check nil signature 2020-04-23 16:26:35 -07:00
Vladimir Buzuev 512f37b369 expose options related to caching 2020-04-03 11:51:20 -07:00
lhchavez 13ca96065e Uprev vendor/libgit2 to v1.0
This uprevs libgit2 to the latest and greatest.
2020-04-02 07:53:59 -07:00
lhchavez 0843b826d2
Fix SIGSEGV on double free for Cred object
This change removes the Go finalizer when passing ownership to libgit2.

Fixes: #553
2020-03-26 17:50:12 -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
Suhaib Mujahid 3a2102638d Update README.md 2020-03-23 18:22:12 -07:00
lhchavez 2b66c0f9e7
Update README.md
Clarifying the versions since we're using Go 1.11 module version rules now.
2020-03-19 08:50:28 -07:00
lhchavez a32375a860 Add the version number to go.mod
This is the second take on trying to tag the current release with a Go
version.
2020-03-19 08:28:34 -07:00
lhchavez e10c2eeef2 Uprev vendor/libgit2 to v0.99
This uprevs libgit2 to the latest and greatest.
2020-03-04 09:54:42 -08:00
lhchavez 30de4b2e26
Merge pull request #542 from slyphon/fix-error-name
Resolves issue #541 - typo in error code 'ErrAmbigious'
2020-02-27 21:16:46 -08:00