textproto

package
v0.0.0-...-6ec90a3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package textproto implements low-level details of the fast-import format.

This package deals with abstracting over special-case commands that break the "line-based" nature of the format (the "data" command, responses to the "cat-blob" command).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatBlobReader

type CatBlobReader struct {
	// contains filtered or unexported fields
}

CatBlobReader is a low-level parser of an fast-import auxiliary "cat-blob" stream.

func NewCatBlobReader

func NewCatBlobReader(r io.Reader) *CatBlobReader

NewCatBlobReader creates a new CatBlobReader parser.

func (*CatBlobReader) ReadLine

func (cbr *CatBlobReader) ReadLine() (line string, err error)

ReadLine reads a response from the stream; with special handling for responses to "cat-blob" commands, which contain multiple newline characters.

type CatBlobWriter

type CatBlobWriter struct {
	// contains filtered or unexported fields
}

CatBlobWriter is a low-level marshaller for an auxiliary cat-blob stream.

func NewCatBlobWriter

func NewCatBlobWriter(w io.Writer) *CatBlobWriter

NewCatBlobWriter creates a new CatBlobWriter marshaller.

func (*CatBlobWriter) WriteBlob

func (cbw *CatBlobWriter) WriteBlob(sha1 string, data string) error

WriteBlob writes a response to a "cat-blob" command to the stream.

func (*CatBlobWriter) WriteLine

func (cbw *CatBlobWriter) WriteLine(a ...interface{}) error

WriteLine writes a response (to a command OTHER THAN "cat-blob") to the stream; arguments are handled similarly to fmt.Println.

Use WriteBlob instead to write responses to "cat-blob" commands.

type FIReader

type FIReader struct {
	// contains filtered or unexported fields
}

FIReader is a low-level parser of a fast-import stream.

func NewFIReader

func NewFIReader(r io.Reader) *FIReader

NewFIReader creates a new FIReader parser.

func (*FIReader) ReadLine

func (fir *FIReader) ReadLine() (line string, err error)

ReadLine reads a "line" from the stream; with special handling for the "data" command, which isn't really a single line, but rather contains arbitrary binary data.

type FIWriter

type FIWriter struct {
	// contains filtered or unexported fields
}

FIWriter is a low-level marshaller of a fast-import stream.

func NewFIWriter

func NewFIWriter(w io.Writer) *FIWriter

NewFIWriter creates a new FIWriter marshaller.

func (*FIWriter) WriteData

func (fiw *FIWriter) WriteData(data string) error

WriteData writes a 'data' command to the stream.

func (*FIWriter) WriteLine

func (fiw *FIWriter) WriteLine(a ...interface{}) error

WriteLine writes an ordinary line to the stream; arguments are handled similarly to fmt.Println.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL