Commit Graph

992 Commits

Author SHA1 Message Date
Jeff Carr c9a7e84e5b try build against 1.8.x
Signed-off-by: Jeff Carr <jcarr@wit.com>
2025-01-05 01:21:58 -06:00
Jeff Carr a4ee4aafbc lame
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-12-17 22:04:22 -06:00
Jeff Carr cf84056045 Merge branch 'devel' 2024-12-17 15:02:44 -06:00
Jeff Carr 585a8dbbe5 rename as libgit2 2024-12-17 15:01:59 -06:00
Jeff Carr d5a0e0056f better gitpb 2024-12-17 13:19:35 -06:00
Jeff Carr 530f3618a8 update to libgit2 version 1.8.4. dump old github and vendor stuff
go install go.wit.com/apps/go-clone@latest
	go install go.wit.com/apps/go-mod-clean@latest
	go-clone --recusive go.wit.com/lib/git2go

Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-12-16 17:50:57 -06:00
Roland Shoemaker e65b1c188c Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto
The golang.org/x/crypto/openpgp library has been deprecated for over a
year now (see golang.org/issue/44226, and the deprecation notice in the
package documentation). The library is unmaintained and has a number of
API and usability issues. ProtonMail maintains a community fork which
is actively maintained, and for most cases is a drop-in replacement.

This change switches usages of golang.org/x/crypto/openpgp/... with
github.com/ProtonMail/go-crypto/openpgp/..., the only other code changes
are adding a nil packet.Config to a openpgp.CheckArmoredDetachedSignature
call.

(This change is part of a wider effort by the Go Security team to remove
usages of golang.org/x/crypto/openpgp from the Go ecosystem.)
2022-12-09 12:43:11 -08:00
lhchavez 4b14d29c20
Fix the `github-tag-action` workflow (#932)
This has been failing for a while because of some changes in `git`.
2022-10-04 18:12:23 -07:00
Sanskar Jaiswal c1ec21d89c
libgit2 v1.5.0 #major (#929)
Update libgit2 to v1.5.0. Replace `SmartProxyOptions()` with `SmartRemoteConnectOptions()`.

Fixes: https://github.com/libgit2/git2go/issues/899

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2022-10-04 07:50:57 -07:00
Calin 9db5de109c
Set BasicAuth in http.go only if username and password are not empty (#914)
This prevents error "read/write on closed pipe".

Go's http.client::send() always closes req.Body, so if the first request attempt
is unsuccessful, any subsequent requests after calling the `CredentialsCallback`
will attempt to read/write on a closed pipe.
2022-07-13 04:50:31 -07:00
lhchavez 7bff4ca7ad
Uprev libgit to v1.3.1 (#911)
🔒 This is a security release to provide compatibility with git's
changes to address [CVE
2022-24765](https://github.blog/2022-04-12-git-security-vulnerability-announced/).

libgit2 (and by extension git2go) are not directly affected by this
vulnerability, because libgit2 does not directly invoke any executable.
But we are providing these changes as a security release for any users
that use libgit2 for repository discovery and then also use git on that
repository. In this release, we will now validate that the user opening
the repository is the same user that owns the on-disk repository. This
is to match git's behavior.

In addition, we are providing several correctness fixes where invalid
input can lead to a crash. These may prevent possible denial of service
attacks. At this time there are not known exploits to these issues.
2022-04-14 07:09:59 -07:00
William Bain eae00773cc
Add refspec bindings (#898)
This add support for the parse, access, and transform functions for
refspec objects.
2022-02-24 19:21:35 -08:00
Patrick Steinhardt e7d1b2b69f
rebase: Add wrapper for `git_rebase_inmemory_index()` (#900)
* rebase: Fix missing initialization of the repo pointer

While the `Rebase` structure has a pointer to the repository the rebase
is creatde in, this pointer isn't ever initialized. Fix this.

* rebase: Add wrapper for `git_rebase_inmemory_index()`

Add a new wrapper for `git_rebase_inmemory_index()`, which can be used
to retrieve the index for an in-memory rebase.

Co-authored-by: Patrick Steinhardt <psteinhardt@gitlab.com>
2022-02-24 05:27:26 -08:00
Dylan Richardson c598ea5718
readme: link to godoc for current main branch (#886)
The GoDoc link currently refers to the initial version of this package, but usually folks are looking
for whatever matches the current main branch. This should be updated whenever the package
version changes.
2022-01-22 17:54:04 -08:00
Aurélien 5eca48cda9
Add ProxyOptions for push operations (#872)
Analog to #623 but for push operations rather than fetch.
2022-01-17 19:02:14 -08:00
James Fargher 1fcc9d8743
Add EnableFsyncGitDir to enable synchronized writes to the gitdir (#874)
This adds support for the GIT_OPT_ENABLE_FSYNC_GITDIR option in libgit2.

Co-authored-by: James Fargher <jfargher@gitlab.com>
2022-01-17 18:51:39 -08:00
Kirill 5e35338d58
Generate stringer files automatically (#841)
Added `stringer` annotations to `git.go` for `ErrorClass` and
`ErrorCode`. Added `generate` rule for `Makefile` to generate
string representations for these types (first building cgo files
in `_obj` dir to get C constants). Finally, updated `ci` actions
workflow to check that generated files are up to date.

Fixes: #543
2021-11-08 06:38:55 -08:00
Ignacio Taranto 533c82f270
Fix replace statement example in README.md (#859) 2021-11-08 06:02:36 -08:00
Sunny 6cea7a7a59
Make ssh commands used in the git smart transport compatible with libgit2 (#852)
* Fix ssh commands used in go SmartSubtransport

Before the fix, the commands sent were of the form:

```
git-upload-pack "/bar/test-reponame"
```

This resulted in the git server returning error:
`error parsing command: invalid git command`

This change replaces the double quotes with single quotes:

```
git-upload-pack '/bar/test-reponame'
```

* Update ssh.go

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
2021-11-07 12:20:56 -08:00
Yashodhan Ghadge 0e8009f00a
bugfix: HTTPS Clone fails with remote pointer not found using Go transport (#836) (#842)
Fixes: #836 

Changes:

* adding a weak bool param for Remote
* create a new remote in the smartTransportCallback incase one is not found
2021-10-23 10:33:10 -07:00
lhchavez 6eae74c128
libgit2 v1.3.0 #major (#840)
This commit introduces libgit2 v1.3.0 to git2go, which brings a large
number of [bugfixes and
features](https://github.com/libgit2/libgit2/releases/tag/v1.3.0).

This also marks the start of the v33 release.
2021-10-14 04:42:42 -07:00
lhchavez 9b155184fe
Allow skipping an entry expansion in `tree.Walk()` (#838)
It is now possible to skip expanding an entry in `tree.Walk()` by
returning `TreeWalkSkip`, in addition to stopping altogether by
returning a non-nil error.

Fixes: #837
2021-09-30 09:24:49 -07:00
lhchavez c6da3b97a8
Allow building libgit2 with Chromium zlib (#831)
This change allows the caller to set the `USE_CHROMIUM_ZLIB=ON`
environment variable to use the Chromium implementation of zlib when
building libgit2.
2021-09-06 05:13:55 -07:00
lhchavez c8ce59d4eb
Add support for Repository.ReachableFromAny() (#826)
This change exposes the binding for `git_graph_reachable_from_any()`.
2021-09-05 20:06:56 -07:00
lhchavez 922f2f7487
Add support for Odb.MultiPackIndex() (#819)
This change exposes the binding for `git_odb_write_multi_pack_index()`.
2021-09-05 19:03:26 -07:00
lhchavez dcc9331226
Expose the ssh.PublicKey into the CertificateCheckCallback (#818)
This change exposes the raw SSH hostkey and the ssh.PublicKey into the
CertificateCheckCallback, so that callers can do better validations.
2021-09-05 19:00:59 -07:00
lhchavez 018647fd48 libgit2 v1.2.0 #major
This commit introduces libgit2 v1.2.0 to git2go, which brings a large
number of [bugfixes and
features](https://github.com/libgit2/libgit2/releases/tag/v1.2.0).

This also marks the start of the v32 release.
2021-09-05 18:52:01 -07:00
lhchavez b78bde3d74 Make all Options objects consistent
This change makes all Options objects have child Option fields as values
(instead of pointers) to mirror the libgit2 interface. It also names
them Options instead of Opts to match the current libgit2 nomenclature
and removes the Version fields.
2021-09-05 18:52:01 -07:00
lhchavez 5def02a589 The big Callback type adjustment of 2020
This change makes all callbacks that can fail return an `error`. This
makes things a lot more idiomatic.
2021-09-05 18:52:01 -07:00
lhchavez 70e5e419cf
Add support for managed SSH transport #minor (#814)
This change drops the (hard) dependency on libssh2 and instead uses Go's
implementation of SSH when libgit2 is not built with it.
2021-09-05 17:04:40 -07:00
lhchavez b983e1daeb
Add support for managed HTTP/S transports (#810)
This change uses the newly-exposed Transport interface to use Go's
implementation of http.Client instead of httpclient via libgit2.
2021-09-05 16:39:07 -07:00
lhchavez f1fa96c7b7
Add support for custom smart transports (#806)
This change adds support for git smart transports. This will be then
used to implement http, https, and ssh transports that don't rely on the
libgit2 library.
2021-09-05 15:44:18 -07:00
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 549706bb57
Declare forward-compatibility with libgit2 v1.2.0 #minor (#800)
We can't yet ship a fully libgit2 v1.2.0-compatible library due to a
missing public symbol, but we can allow the v1.1.0-era codebase to link
against libgit2 v1.2.0 in the meantime.
2021-09-04 20:07:24 -07:00
lhchavez 2077003fa5
Prepare for the v1.2.0 release (#796)
This change adds a few more deprecation messages just before we remove
them.
2021-09-04 14:14:47 -07:00
Gustav Westling d4524761d9
Add DiffIgnoreWitespaceEol and deprecate DiffIgnoreWitespaceEol (#774)
DiffIgnoreWitespaceEol contains a typo and does not have the same name as it's libgit2 counterpart.

Fixes #773
2021-09-04 13:54:21 -07:00
lhchavez 15434610fe
Add `CreateCommitWithSignature` (#782)
This change adds the wrapper for `git_commit_create_with_signature`.
2021-09-04 13:49:01 -07:00
lhchavez be5a99a807
Rename the default branch to `main` (#786)
We've renamed the default branch from `master` to `main`, so we need to
change a bunch of references to that.
2021-09-04 13:33:34 -07:00
lhchavez fbaf9d1d1a
Add `Repository.CreateCommitBuffer` (#781)
This commit adds the Go binding for `git_commit_create_buffer`. This
will be used to support the 1.2.0 commit create callback.
2021-09-04 13:04:58 -07:00
lhchavez df7084d36a
Remove the legacy builders (#776)
These builds are no longer working because some of the dependencies now
require newer versions of Go. Seems like the ecosystem has moved to Go
1.11+, so we are now forced to follow suit.
2021-09-03 06:28:00 -07:00
Vladimir Buzuev 1e2cb92b48
add wrapper for git_config_open_default (#758) 2021-04-03 18:45:55 -07:00
Vladimir Buzuev 0d7c8dadb4
fix buldled static build on Windows/MinGW (#761)
seems like need more libraries in LDFLAGS:

* ws2_32 for socket, connect, htonl, etc
* ole32 for CoInitializeEx
* rpcrt4 for UuidCreate
* crypt32 for CertFreeCertificateContext
2021-04-03 18:45:09 -07:00
Vladimir Buzuev a4d202ed7b
Git repository item path (#757)
add wrapper for `git_repository_item_path`
2021-04-03 16:52:34 -07:00
michael boulton aeb22bcf7d
Make index time fields public (#750)
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
2021-02-15 07:37:55 -08:00
Suhaib Mujahid f6c5753df8
fix: Use `err` instead of error as a variable name for errors (#746)
fix #745
2021-02-15 07:26:19 -08:00
Byoungchan Lee 2fd0495c43
Implement git_repository_set_config (#735)
Closes #732
2021-02-03 19:33:03 -08:00
Byoungchan Lee 73d97b9bbe
Support git_remote_create_with_opts (#733)
Closes #645
2021-02-03 18:58:31 -08:00
Byoungchan Lee 07147a8ea8
Support git_repository_message, git_repository_message_remove (#734)
Closes #646
2021-02-02 19:42:21 -08:00
lhchavez 4b2ac7c998
Rename the build files (#724)
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: #711
Fixes: #617
2020-12-13 15:20:16 -08: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