Commit Graph

871 Commits

Author SHA1 Message Date
lhchavez d6c2d12ee1 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.

(cherry picked from commit c78ae57de6)
2020-08-16 07:19:20 -07:00
lhchavez decab2d988 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.

(cherry picked from commit 619a9c236b)
2020-08-16 07:19:20 -07:00
lhchavez e4b04e142b 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
(cherry picked from commit 9eaf4fed5f)
2020-08-16 07:19:20 -07:00
Takuji Shimokawa 496b346c97 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:20 -07:00
Jesse Hathaway 354218d9bb Add support for parsing git trailers (#614)
Adds a wrapper for git_message_trailers which returns a slice of trailer
structs.

(cherry picked from commit 5241c72e6e)
2020-08-16 07:19:20 -07:00
lhchavez 7b83382e04 Merge pull request #582 from suhaibmujahid/method-rename
It is not Go idiomatic to put Get into the getter's name

(cherry picked from commit 31f877e249)
2020-08-16 07:19:20 -07:00
lhchavez b8df55f956 expose options related to caching
(cherry picked from commit 8b51d0db8e)
2020-08-16 07:19:20 -07:00
Suhaib Mujahid b2fae9430f Check nil signature
(cherry picked from commit 91d08450b6)
2020-08-16 07:19:20 -07:00
lhchavez 707a03b581 Fix SIGSEGV on double free for Cred object
This change removes the Go finalizer when passing ownership to libgit2.

Fixes: #553
(cherry picked from commit 0843b826d2)
2020-08-16 07:19:20 -07:00
Suhaib Mujahid 4681adf414 Update README.md
(cherry picked from commit 3a2102638d)
2020-08-16 07:19:20 -07:00
lhchavez 752bac6334 Update README.md
Clarifying the versions since we're using Go 1.11 module version rules now.

(cherry picked from commit 2b66c0f9e7)
2020-08-16 07:19:20 -07:00
lhchavez 84b7f45673 Add the version number to go.mod
This is the second take on trying to tag the current release with a Go
version.

(cherry picked from commit a32375a860)
2020-08-16 07:19:20 -07:00
lhchavez 1526448a89 Merge pull request #542 from slyphon/fix-error-name
Resolves issue #541 - typo in error code 'ErrAmbigious'

(cherry picked from commit 30de4b2e26)
2020-08-16 07:19:20 -07:00
lhchavez f4a3dd4cc7 Fix the DiffFlag type
This change makes the underlying type of DiffFlag be uint32 instead of
int. That makes it possible to build on 32-bit systems.

Fixes: #487
(cherry picked from commit 93c4c5b30a)
2020-08-16 07:19:20 -07:00
lhchavez 1c82797e35 Add odb.NewOdbBackendLoose()
This change adds support for odb.NewOdbBackendLoose(). This, together
with the git.Packbuilder, can do what Mempack does with a lot less
memory.

(cherry picked from commit 91946a5705)
2020-08-16 07:19:20 -07:00
lhchavez 2fe03c06e7 Add support for indexers and alternate odb packfiles
This allows for implementations of git servers written in Go.

(cherry picked from commit 05bc5e36ff)
2020-08-16 07:19:20 -07:00
lhchavez 686500ef90 Merge pull request #429 from josharian/cherrypick-commit
cherrypick: wrap git_cherrypick_commit
(cherry picked from commit 45097a857c)
2020-08-16 07:19:20 -07:00
lhchavez d84378238a 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:20 -07:00
lhchavez e43846bffd Merge pull request #400 from ramanenka/git_index_add_frombuffer
Add binding for `git_index_add_frombuffer`

(cherry picked from commit 06764f48dc)
2020-08-16 07:19:20 -07:00
Richard Burke bd2a0c830e Remove Version from RevertOptions
Version is defaulted to GIT_REVERT_OPTIONS_VERSION

(cherry picked from commit 4bca045e5a)
2020-08-16 07:19:20 -07:00
Richard Burke b55ee91e3c Add revert functionality
Closes #436

(cherry picked from commit 30c3d0ffe2)
2020-08-16 07:19:20 -07:00
lhchavez 2fba250690 Free() the copies of repository.LookupXxx()
`repository.LookupXxx()` allocate new go `Object`s that have a reference
to a `C.git_object`. Those are then duplicated with `git_object_dup()`,
so the original `Object`s linger unnecessarily until the Go GC kicks in.

This change explicitly calls `Free()` on the originals to avoid
unnecessary accumulation of garbage.

(cherry picked from commit 2bb5930733)
2020-08-16 07:19:20 -07:00
lhchavez d47253fb80 Update CI configuration
This change:

* Updates the GitHub actions so that they run different commands for the
  dynamic and static flavors of libgit2.
* Updates the .travis.yml file so that it does roughly the same as the
  GitHub actions.
* Adds the release-* branches to the CI configurations.

(cherry picked from commit 26edffd5f5)
2020-08-16 07:19:20 -07:00
lhchavez 9f2bfe5f32 Merge pull request #520 from libgit2/actions
Setup CI via Actions

(cherry picked from commit f21ecd9e74)
2020-08-16 07:19:20 -07:00
lhchavez 75b56d820b Merge pull request #527 from dbolkensteyn/master
Fixes #513 - Segfault during tree walk

(cherry picked from commit 75c5e41422)
2020-08-16 07:19:20 -07:00
lhchavez 61d996a04e Merge pull request #523 from josharian/diff-stringers
make Delta and DiffLineType stringers

(cherry picked from commit 11506ab070)
2020-08-16 07:19:20 -07:00
lhchavez cba876ecd1 Merge pull request #524 from josharian/doc-params
provide param names in DiffForEachFileCallback

(cherry picked from commit 917d8dcb9e)
2020-08-16 07:19:20 -07:00
lhchavez f3992bae37 Merge pull request #503 from jonEbird/static-build-script-cleanup
script/build-libgit2-static.sh: correctly set ROOT

(cherry picked from commit aa802a90db)
2020-08-16 07:19:20 -07:00
Carlos Martín Nieto e7a003dacc Merge pull request #506 from takuji/git_commit_message_encoding
Add git_commit_message_encoding support

(cherry picked from commit b2e2b2f71b)
2020-08-16 07:19:20 -07:00
Carlos Martín Nieto 19ac948456 Merge pull request #512 from codeocean/diff-to-buf
Add Diff.ToBuf wrapping git_diff_to_buf

(cherry picked from commit 4fa9349942)
2020-08-16 07:19:20 -07:00
lhchavez 7694d5f5fc Add the /v28 suffix to go.mod
This is compliant with
https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher,
which says

```
Major branch: Update the go.mod file to include a /v3 at the end of the
module path in the module directive (e.g., module
github.com/my/module/v3). Update import statements within the module to
also use /v3 (e.g., import "github.com/my/module/v3/mypkg"). Tag the
release with v3.0.0.
```

This also means that unfortunately we cannot keep using libgit2's exact
version number (plus a build number for git2go purposes, since go only
recognizes vMAJOR.MINOR.PATCH format).

(Tentatively) fixes: #536
2020-02-18 19:50:49 -08:00
lhchavez 437c7c3344
Merge pull request #531 from suhaibmujahid/patch-1
Switch over the version constraints to v0.28
2020-02-16 06:44:16 -08:00
Suhaib Mujahid 70058bd989
Switch over the version constraints to v0.28 2020-01-17 22:09:18 -05:00
Carlos Martín Nieto b1eec9a466
Merge pull request #530 from libgit2/cmn/bump-libgit2-28
Update libgit2 to v0.28.4
2019-12-10 23:15:50 +01:00
Carlos Martín Nieto a478c6d7ef Update libgit2 to v0.28.4 2019-12-10 21:47:55 +00:00
Carlos Martín Nieto bf1e8a4338
Merge pull request #479 from lhchavez/uprev-libgit2
Uprev vendored libgit2 to v.0.28
2019-02-15 14:26:37 +01:00
lhchavez 5fda6dd901 Uprev vendored libgit2 to v0.28
New version is here!
2019-02-11 03:57:50 +00:00
Carlos Martín Nieto 2f91268f74
Merge pull request #448 from lhchavez/mempack
Add support for mempack
2019-01-15 20:46:54 +01:00
Carlos Martín Nieto f4ea2a561d Keep odb alive when adding mempack 2019-01-15 20:28:36 +01:00
Carlos Martín Nieto 8766f9f36c
Merge pull request #466 from lhchavez/repository-create_commit_from_ids
Add support for CreateCommitFromIds
2019-01-08 09:30:36 +00:00
lhchavez 6d67bde74a Merge remote-tracking branch 'upstream/master' into repository-create_commit_from_ids 2019-01-08 02:51:21 +00:00
lhchavez 35518c78df Keeping the tree alive 2019-01-08 02:50:42 +00:00
lhchavez f505e39c9e Add a test and some comments as to the ugly pointer arithmetic 2019-01-08 02:50:25 +00:00
lhchavez a2c93a0bcf Addressed review feedback and added a test 2019-01-08 02:45:04 +00:00
lhchavez b609c04b68 Merge remote-tracking branch 'upstream/master' into mempack 2019-01-08 02:01:44 +00:00
Carlos Martín Nieto 2609f4c6f2
Merge pull request #477 from lhchavez/patch-1
Add support for Go 1.11 modules
2019-01-07 16:00:59 +00:00
Carlos Martín Nieto b30b050c9c
Merge pull request #475 from lhchavez/self-contained-build
Improve the static build script
2019-01-07 14:02:51 +00:00
Carlos Martín Nieto e93f34cf18
Merge pull request #476 from lhchavez/clean-up-leaked-dir
Clean up one leaked temporary directory
2019-01-07 12:33:43 +00:00
lhchavez 30c57ff09e
Add support for Go 1.11 modules
This change adds a `go.mod` file. An empty file is sufficient since this
project has no external dependencies. For people that want to use the static
version of libgit2, this module can be vendored and the following can be added
to their `go.mod` file:

    replace github.com/libgit2/git2go => ./vendor/github.com/libgit2/git2go
2019-01-06 07:34:50 -08:00
lhchavez e9856f2c38 Clean up one leaked temporary directory
A `defer cleanupTestRepo()` was missing.
2019-01-05 22:41:35 +00:00