diff options
| author | lhchavez <[email protected]> | 2020-12-05 07:23:44 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-05 07:23:44 -0800 |
| commit | 137c05e802d5e11a5ab54809bc8be8f61ccece21 (patch) | |
| tree | b44997824565f9506744a4259177746b83112e92 /blob.go | |
| parent | 1fabe95fb7275df980ff6ab03fb85eac91c5849d (diff) | |
Mark some symbols to be deprecated #minor (#698)
This change introduces the file deprecated.go, which contains any
constants, functions, and types that are slated to be deprecated in the
next major release.
These symbols are deprecated because they refer to old spellings in
pre-1.0 libgit2. This also makes the build be done with the
`-DDEPRECATE_HARD` flag to avoid regressions.
This, together with
[gorelease](https://godoc.org/golang.org/x/exp/cmd/gorelease)[1] should
make releases safer going forward.
1: More information about how that works at
https://go.googlesource.com/exp/+/refs/heads/master/apidiff/README.md
Diffstat (limited to 'blob.go')
| -rw-r--r-- | blob.go | 33 |
1 files changed, 3 insertions, 30 deletions
@@ -9,7 +9,6 @@ void _go_git_writestream_free(git_writestream *stream); */ import "C" import ( - "io" "reflect" "runtime" "unsafe" @@ -68,7 +67,7 @@ func (repo *Repository) CreateBlobFromBuffer(data []byte) (*Oid, error) { size = C.size_t(0) } - ecode := C.git_blob_create_frombuffer(&id, repo.ptr, unsafe.Pointer(&data[0]), size) + ecode := C.git_blob_create_from_buffer(&id, repo.ptr, unsafe.Pointer(&data[0]), size) runtime.KeepAlive(repo) if ecode < 0 { return nil, MakeGitError(ecode) @@ -76,32 +75,6 @@ func (repo *Repository) CreateBlobFromBuffer(data []byte) (*Oid, error) { return newOidFromC(&id), nil } -type BlobChunkCallback func(maxLen int) ([]byte, error) - -type BlobCallbackData struct { - Callback BlobChunkCallback - Error error -} - -//export blobChunkCb -func blobChunkCb(buffer *C.char, maxLen C.size_t, handle unsafe.Pointer) int { - payload := pointerHandles.Get(handle) - data, ok := payload.(*BlobCallbackData) - if !ok { - panic("could not retrieve blob callback data") - } - - goBuf, err := data.Callback(int(maxLen)) - if err == io.EOF { - return 0 - } else if err != nil { - data.Error = err - return -1 - } - C.memcpy(unsafe.Pointer(buffer), unsafe.Pointer(&goBuf[0]), C.size_t(len(goBuf))) - return len(goBuf) -} - func (repo *Repository) CreateFromStream(hintPath string) (*BlobWriteStream, error) { var chintPath *C.char = nil var stream *C.git_writestream @@ -114,7 +87,7 @@ func (repo *Repository) CreateFromStream(hintPath string) (*BlobWriteStream, err runtime.LockOSThread() defer runtime.UnlockOSThread() - ecode := C.git_blob_create_fromstream(&stream, repo.ptr, chintPath) + ecode := C.git_blob_create_from_stream(&stream, repo.ptr, chintPath) if ecode < 0 { return nil, MakeGitError(ecode) } @@ -166,7 +139,7 @@ func (stream *BlobWriteStream) Commit() (*Oid, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() - ecode := C.git_blob_create_fromstream_commit(&oid, stream.ptr) + ecode := C.git_blob_create_from_stream_commit(&oid, stream.ptr) runtime.KeepAlive(stream) if ecode < 0 { return nil, MakeGitError(ecode) |
