Documentation ¶
Index ¶
- Constants
- type Change
- type ChangeType
- type Command
- func (c *Command) CatFile(objectType string, hash string) ([]byte, error)
- func (c *Command) ListBranches(handler func(branch string) error) error
- func (c *Command) ListCommits(ref string, handler func(branch string) error) error
- func (c *Command) ListTags(handler func(branch string) error) error
- func (c *Command) LsTree(reference string, path string, handler func(entry TreeEntry) error) error
- type Commit
- type FileMode
- type FileType
- type ObjectType
- type PermissionMask
- type TreeEntry
Constants ¶
const ChangeHashMissing = "0000000000000000000000000000000000000000"
ChangeHashMissing is used by git to represent when a file cannot have a hash defined. The logic for when this is used is defined in https://git-scm.com/docs/git-diff-tree#_raw_output_format.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct { Type ChangeType PreviousHash, Hash string // The previous hash of the file and the new hash of the file. PreviousMode, Mode FileMode Path string }
Change describes a modification to a single file. Refer to git's documentation about what is possible to include: https://git-scm.com/docs/git-diff-tree#_raw_output_format
type ChangeType ¶
type ChangeType uint8
ChangeType describes the type of modification done to the file in the git index. A full enumerations of types can be found on git's docs: https://git-scm.com/docs/git-diff-tree#:~:text=Possible%20status%20letters%20are
const ( // ChangeUnknown represents X the change type from git-diff-tree. ChangeUnknown ChangeType = iota // ChangeAddition represents A the change type from git-diff-tree. ChangeAddition // ChangeCopy represents C the change type from git-diff-tree. ChangeCopy // ChangeDeletion represents D the change type from git-diff-tree. ChangeDeletion // ChangeModification represents M the change type from git-diff-tree. ChangeModification // ChangeRename represents R the change type from git-diff-tree. ChangeRename // ChangeFileType represents T the change type from git-diff-tree. ChangeFileType // ChangeUnmerged represents U the change type from git-diff-tree. ChangeUnmerged )
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) CatFile ¶
CatFile is a wrapper around the git cat-file command. Read more here: https://git-scm.com/docs/git-cat-file.
func (*Command) ListBranches ¶
ListBranches calls handler for with the name of every branch in the git repo.
func (*Command) ListCommits ¶
ListCommits calls handler for with the hash of every commit in the history of ref.
type FileMode ¶
type FileMode struct { Type FileType Perms PermissionMask }
FileMode is a struct representing the "type" of a file in the git repo. This is a tuple of FileType and PermissionMask.
func NewFileMode ¶
NewFileMode takes a git file mode oct and turns it into fs.FileMode objects. It performs other fixes to the file mode to hack around edge cases in git. More details are available here: https://unix.stackexchange.com/a/450488
type ObjectType ¶
type ObjectType uint8
const ( UnknownObjectType ObjectType = iota BlobObject TreeObject )
func NewObjectType ¶
func NewObjectType(name string) ObjectType
func (ObjectType) String ¶
func (t ObjectType) String() string
type PermissionMask ¶
type PermissionMask uint16
PermissionMask represents the underlying representation git uses for defining permissions. This format is described in this stackoverflow post: https://unix.stackexchange.com/a/450488
func (PermissionMask) String ¶
func (mask PermissionMask) String() string