Add support for CreateCommitFromIds #466

Merged
lhchavez merged 4 commits from repository-create_commit_from_ids into master 2019-01-08 03:30:37 -06:00
lhchavez commented 2018-11-14 21:22:28 -06:00 (Migrated from github.com)

This change adds support for CreateCommitFromIds from libgit2.

This change adds support for CreateCommitFromIds from libgit2.
carlosmn (Migrated from github.com) reviewed 2019-01-03 18:41:23 -06:00
carlosmn (Migrated from github.com) commented 2019-01-03 18:40:29 -06:00

It looks like this should be C.calloc. Should we be using sizeof on *C.git_oid rather than a generic pointer?

It looks like this should be `C.calloc`. Should we be using sizeof on `*C.git_oid` rather than a generic pointer?
carlosmn (Migrated from github.com) commented 2019-01-03 18:41:15 -06:00

Can we avoid this pointer arithmetic? Can we generate the array in Go and pass that pointer to C.git_commit_create_from_ids?

Can we avoid this pointer arithmetic? Can we generate the array in Go and pass that pointer to `C.git_commit_create_from_ids`?
lhchavez (Migrated from github.com) reviewed 2019-01-03 19:17:52 -06:00
lhchavez (Migrated from github.com) commented 2019-01-03 19:17:52 -06:00

IIRC this was a workaround for the dreaded cgo argument has Go pointer to Go pointer. admittedly, i didn't invest too much time trying more options, so let me give it another try.

worst case scenario, i'll add a comment.

IIRC this was a workaround for the dreaded [cgo argument has Go pointer to Go pointer](https://stackoverflow.com/questions/51483032/passing-go-pointer-to-cgo). admittedly, i didn't invest too much time trying more options, so let me give it another try. worst case scenario, i'll add a comment.
lhchavez (Migrated from github.com) reviewed 2019-01-05 16:37:49 -06:00
lhchavez (Migrated from github.com) commented 2019-01-05 16:37:49 -06:00

I chose malloc since i was writing to the entire array, but C.calloc looks a bit cleaner.

I chose malloc since i was writing to the entire array, but `C.calloc` looks a bit cleaner.
lhchavez (Migrated from github.com) reviewed 2019-01-05 16:38:08 -06:00
lhchavez (Migrated from github.com) commented 2019-01-05 16:38:07 -06:00

Tried different things, but now I'm pretty sure we cannot avoid this :( added a comment.

Tried different things, but now I'm pretty sure we cannot avoid this :( added a comment.
carlosmn (Migrated from github.com) reviewed 2019-01-07 10:29:18 -06:00
carlosmn (Migrated from github.com) commented 2019-01-07 10:29:18 -06:00

It's more about the overflow protection, though unlikely to be an issue here. It also indicates to readers that we are dealing with arrays.

It's more about the overflow protection, though unlikely to be an issue here. It also indicates to readers that we are dealing with arrays.
carlosmn (Migrated from github.com) reviewed 2019-01-07 10:38:49 -06:00
carlosmn (Migrated from github.com) left a comment

It looks like you accidentally commited a change to the libgit2 submodule.

It looks like you accidentally commited a change to the libgit2 submodule.
@ -392,2 +460,4 @@
}
func (v *Odb) Free() {
runtime.SetFinalizer(v, nil)
carlosmn (Migrated from github.com) commented 2019-01-07 10:32:13 -06:00

We also need to keep tree alive.

We also need to keep `tree` alive.
lhchavez (Migrated from github.com) reviewed 2019-01-07 20:52:17 -06:00
@ -392,2 +460,4 @@
}
func (v *Odb) Free() {
runtime.SetFinalizer(v, nil)
lhchavez (Migrated from github.com) commented 2019-01-07 20:52:17 -06:00

Done

Done
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jcarr/git2go#466
No description provided.