Add support for parsing git trailers #614
|
@ -34,10 +34,9 @@ func MessageTrailers(message string) ([]Trailer, error) {
|
|||
|
||||
defer C.git_message_trailer_array_free(&trailersC)
|
||||
trailers := make([]Trailer, trailersC.count)
|
||||
var trailer *C.git_message_trailer
|
||||
for i, p := 0, uintptr(unsafe.Pointer(trailersC.trailers)); i < int(trailersC.count); p += unsafe.Sizeof(C.git_message_trailer{}) {
|
||||
![]() 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).
![]() maybe
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.
|
||||
for i, p := 0, uintptr(unsafe.Pointer(trailersC.trailers)); i < int(trailersC.count); i, p = i+1, p+unsafe.Sizeof(C.git_message_trailer{}) {
|
||||
![]() 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).
![]() maybe
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.
|
||||
trailer = (*C.git_message_trailer)(unsafe.Pointer(p))
|
||||
trailers[i] = Trailer{Key: C.GoString(trailer.key), Value: C.GoString(trailer.value)}
|
||||
i++
|
||||
![]() 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).
![]() maybe
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.
|
||||
}
|
||||
return trailers, nil
|
||||
}
|
||||
|
|
|||
![]() 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).
![]() 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).
![]() maybe
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.
![]() maybe
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.
|
minor nit:
(if this was copied from another file, let me know which one and we'll fix that later).
minor nit:
(if this was copied from another file, let me know which one and we'll fix that later).
maybe
for a tiny bit more symmetry between the initialization and post-steps.
maybe
for a tiny bit more symmetry between the initialization and post-steps.