Add support for parsing git trailers #614

Merged
lollipopman merged 5 commits from trailers into master 2020-06-02 12:30:42 -05:00
lollipopman commented 2020-06-01 16:44:57 -05:00 (Migrated from github.com)

Adds a wrapper for git_message_trailers which returns a slice of trailer
structs.

First pull request for git2go & first use of cgo, criticism welcomed, thanks!

Adds a wrapper for git_message_trailers which returns a slice of trailer structs. First pull request for git2go & first use of cgo, criticism welcomed, thanks!
lhchavez (Migrated from github.com) reviewed 2020-06-01 20:47:56 -05:00
lhchavez (Migrated from github.com) left a comment

nice! just a few minor requests.

nice! just a few minor requests.
lhchavez (Migrated from github.com) commented 2020-06-01 20:39:38 -05:00

minor nit:

(if this was copied from another file, let me know which one and we'll fix that later).

minor nit: ```suggestion ``` (if this was copied from another file, let me know which one and we'll fix that later).
lhchavez (Migrated from github.com) commented 2020-06-01 20:45:12 -05:00

maybe

	for i, p := 0, uintptr(unsafe.Pointer(trailersC.trailers)); i < int(trailersC.count); i, p = i + 1, p + unsafe.Sizeof(C.git_message_trailer{}) {

for a tiny bit more symmetry between the initialization and post-steps.

maybe ```suggestion for i, p := 0, uintptr(unsafe.Pointer(trailersC.trailers)); i < int(trailersC.count); i, p = i + 1, p + unsafe.Sizeof(C.git_message_trailer{}) { ``` for a tiny bit more symmetry between the initialization and post-steps.
@ -0,0 +18,4 @@
// MessageTrailers parses trailers out of a message, returning a slice of
// Trailer structs. Trailers are key/value pairs in the last paragraph of a
// message, not including any patches or conflicts that may be present.
func MessageTrailers(message string) ([]Trailer, error) {
lhchavez (Migrated from github.com) commented 2020-06-01 20:37:41 -05:00

Can the docstrings from libgit2 be copied (+adapted) as the golang docstrings? For example, this could be

// MessageTrailers parses trailers out of a message. Trailers are key/value
// pairs in the last paragraph of a message, not including any patches or
// conflicts that may be present.

Same for Trailer above in L12 (from 849f371ea8/include/git2/message.h (L41))

Can the docstrings from [libgit2](https://libgit2.org/libgit2/#HEAD/group/message/git_message_trailers) be copied (+adapted) as the golang docstrings? For example, this could be ```go // MessageTrailers parses trailers out of a message. Trailers are key/value // pairs in the last paragraph of a message, not including any patches or // conflicts that may be present. ``` Same for `Trailer` above in L12 (from https://github.com/libgit2/libgit2/blob/849f371ea89257512ef505d0094d77b1ec812c53/include/git2/message.h#L41)
lollipopman commented 2020-06-02 12:02:55 -05:00 (Migrated from github.com)

@lhchavez thanks for your detailed review, I believe I addressed all of you feedback, but please let me know if there is anything I missed!

@lhchavez thanks for your detailed review, I believe I addressed all of you feedback, but please let me know if there is anything I missed!
lhchavez commented 2020-06-02 12:30:24 -05:00 (Migrated from github.com)

@lhchavez thanks for your detailed review, I believe I addressed all of you feedback, but please let me know if there is anything I missed!

it's all good! thanks for doing this!

> @lhchavez thanks for your detailed review, I believe I addressed all of you feedback, but please let me know if there is anything I missed! it's all good! thanks for doing this!
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#614
No description provided.