mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-07 23:27:41 +00:00
Implement git refs API for listing references (branches, tags and other) (#5354)
* Inital routes to git refs api * Git refs API implementation * Update swagger * Fix copyright * Make swagger happy add basic test * Fix test * Fix test again :)
This commit is contained in:
parent
294904321c
commit
08bf443016
268 changed files with 48603 additions and 10 deletions
50
vendor/gopkg.in/src-d/go-git.v4/utils/binary/write.go
generated
vendored
Normal file
50
vendor/gopkg.in/src-d/go-git.v4/utils/binary/write.go
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
package binary
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Write writes the binary representation of data into w, using BigEndian order
|
||||
// https://golang.org/pkg/encoding/binary/#Write
|
||||
func Write(w io.Writer, data ...interface{}) error {
|
||||
for _, v := range data {
|
||||
if err := binary.Write(w, binary.BigEndian, v); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func WriteVariableWidthInt(w io.Writer, n int64) error {
|
||||
buf := []byte{byte(n & 0x7f)}
|
||||
n >>= 7
|
||||
for n != 0 {
|
||||
n--
|
||||
buf = append([]byte{0x80 | (byte(n & 0x7f))}, buf...)
|
||||
n >>= 7
|
||||
}
|
||||
|
||||
_, err := w.Write(buf)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// WriteUint64 writes the binary representation of a uint64 into w, in BigEndian
|
||||
// order
|
||||
func WriteUint64(w io.Writer, value uint64) error {
|
||||
return binary.Write(w, binary.BigEndian, value)
|
||||
}
|
||||
|
||||
// WriteUint32 writes the binary representation of a uint32 into w, in BigEndian
|
||||
// order
|
||||
func WriteUint32(w io.Writer, value uint32) error {
|
||||
return binary.Write(w, binary.BigEndian, value)
|
||||
}
|
||||
|
||||
// WriteUint16 writes the binary representation of a uint16 into w, in BigEndian
|
||||
// order
|
||||
func WriteUint16(w io.Writer, value uint16) error {
|
||||
return binary.Write(w, binary.BigEndian, value)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue