MCPcopy Create free account
hub / github.com/libgit2/git2go / CreateFromStream

Method CreateFromStream

blob.go:79–97  ·  view source on GitHub ↗
(hintPath string)

Source from the content-addressed store, hash-verified

77}
78
79func (repo *Repository) CreateFromStream(hintPath string) (*BlobWriteStream, error) {
80 var chintPath *C.char = nil
81 var stream *C.git_writestream
82
83 if len(hintPath) > 0 {
84 chintPath = C.CString(hintPath)
85 defer C.free(unsafe.Pointer(chintPath))
86 }
87
88 runtime.LockOSThread()
89 defer runtime.UnlockOSThread()
90
91 ecode := C.git_blob_create_from_stream(&stream, repo.ptr, chintPath)
92 if ecode < 0 {
93 return nil, MakeGitError(ecode)
94 }
95
96 return newBlobWriteStreamFromC(stream, repo), nil
97}
98
99type BlobWriteStream struct {
100 doNotCompare

Callers

nothing calls this directly

Calls 3

MakeGitErrorFunction · 0.85
newBlobWriteStreamFromCFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected