seems like need more libraries in LDFLAGS:
* ws2_32 for socket, connect, htonl, etc
* ole32 for CoInitializeEx
* rpcrt4 for UuidCreate
* crypt32 for CertFreeCertificateContext
(cherry picked from commit 0d7c8dadb4)
Co-authored-by: Vladimir Buzuev <44682889+vladimir-buzuev@users.noreply.github.com>
add wrapper for `git_repository_item_path`
(cherry picked from commit a4d202ed7b)
Co-authored-by: Vladimir Buzuev <44682889+vladimir-buzuev@users.noreply.github.com>
From gorelease:
```
Compatible changes:
- IndexTime.Nanoseconds: added
- IndexTime.Seconds: added
```
There are no extra tests because there isn't really anything to test
closes#304
(cherry picked from commit aeb22bcf7d)
Co-authored-by: michael boulton <61595820+mbfr@users.noreply.github.com>
This change renames the build files so they come lexicographically
before any source files. This makes the compile errors (due to
mismatched libgit2 versions) easier to understand, since the
`Build_*.go` files will be tried before the rest, and the `#error` in
those files will kick in, leading to a much better experience.
This unfortunately goes a bit against the defacto standard of using only
lowercase characters in filenames, but the better developer experience
(and better self-diagnosis when things go wrong instead of having to
open a new issue) is worth the deviation.
Fixes: #711Fixes: #617
(cherry picked from commit 4b2ac7c998)
Co-authored-by: lhchavez <lhchavez@lhchavez.com>
This change adds support for MergeBaseMany, MergeBasesMany, and
MergeBaseOctopus.
(cherry picked from commit 698ddfb4ac)
Co-authored-by: lhchavez <lhchavez@lhchavez.com>
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)
This change makes sure that pointer handles are correctly cleaned up
during tests.
(cherry picked from commit e28cce87c7)
Co-authored-by: lhchavez <lhchavez@lhchavez.com>
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)
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)
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)
Added power support for the travis.yml file with ppc64le. This is part of the Ubuntu distribution for ppc64le. This helps us simplify testing later when distributions are re-building and re-releasing.
(cherry picked from commit 2d639d8e49)
Co-authored-by: Devendra <devendranath.thadi3@gmail.com>
Add a binding to enable/disable hash verification using the `GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION` option.
Change type: #minor
(cherry picked from commit c3664193f3)
Co-authored-by: Suhaib Mujahid <suhaibmujahid@gmail.com>
This change:
* Makes the Travis tests only run tip, since the rest of the Go versions are better served by GitHub Actions.
* Use Go 1.15 in the CI. This has been released for a while.
(cherry picked from commit f83530b18d)
While we already have wrappers for `git_object_lookup`, there are none
yet for the prefixed variant where only the first n bytes of the OID are
used for the lookup. This commit adds them.
(cherry picked from commit 37b81b61f1)
Co-authored-by: Patrick Steinhardt <ps@pks.im>
#### Problem:
The current `CMAKE_INSTALL_PREFIX` value for the `system` build mode is `/usr`. However, in`macOS` as an example, you cannot write to `/usr` without `sudo` permission.
#### Proposed solution:
Enable changing the value to `/usr/local` (or any other path). This change makes the script use the value of the environment variable `SYSTEM_INSTALL_PREFIX` to select the installation path. If the variable is not set, it fallback to the path `/usr`.
(cherry picked from commit 111185838c)
Co-authored-by: Suhaib Mujahid <suhaibmujahid@gmail.com>
### What this change is doing?
This change aims to enable us to set the `VENDORED_PATH` as an environment variable and failback to the default value if the environment variable is not set. Thus, this change should not break current behavior.
### Why we need this?
This will enable using the script to build libgit2 form source code downloaded manually.
Example:
```sh
LIBGIT2_VER="1.0.1"
DOWNLOAD_URL="https://codeload.github.com/libgit2/libgit2/tar.gz/v${LIBGIT2_VER}""
LIBGIT2_PATH="${HOME}/libgit2-${LIBGIT2_VER}"
wget -O "${LIBGIT2_PATH}.tar.gz" "$DOWNLOAD_URL"
tar -xzvf "${LIBGIT2_PATH}.tar.gz"
VENDORED_PATH=$LIBGIT2_PATH sh ./script/build-libgit2.sh --static
```
(cherry picked from commit f3a746d7b6)
Co-authored-by: Suhaib Mujahid <suhaibmujahid@gmail.com>
libgit2 stores the lookup paths for gitconfig files in its global state.
This means that after a program changes its effective uid libgit2 will
still look for gitconfig files in the home directory of the original
uid. Expose a way to call C.git_libgit2_init so a user can reinitialize
the libgit2 global state.
(cherry picked from commit 3c5c580d78)
Co-authored-by: Jesse Hathaway <jesse@mbuki-mvuki.org>
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>
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
(cherry picked from commit 7883ec85de)
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.
(cherry picked from commit 2ac9f4e69b)
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.
(cherry picked from commit 5314951759)
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.
(cherry picked from commit b1cad11555)
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.
(cherry picked from commit 20a55cdf92)
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)
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)
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)
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)