Documentation
¶
Index ¶
- Constants
- type BlobObject
- type Branch
- type Color
- type CommitGraph
- type CommitObject
- func (commit *CommitObject) GenerateContent()
- func (commit *CommitObject) ReadFromExistingObject(sha1Name string)
- func (commit *CommitObject) SetAuthor(author string)
- func (commit *CommitObject) SetCommitter(committer string)
- func (commit *CommitObject) SetMessage(message string)
- func (commit *CommitObject) SetParents(parents []string)
- func (commit *CommitObject) SetTree(tree string)
- type GitObject
- type Graph
- func (graph *Graph) AddEdge(source string, target string)
- func (graph *Graph) AddNode(typ string, name string, sha1Name []byte)
- func (graph *Graph) BFS(source_node *GraphNode, before_callback func(*GraphNode), ...)
- func (graph *Graph) DFS(before_callback func(*GraphNode), after_callback func(*GraphNode))
- func (graph *Graph) LookUpNode(name string) (*GraphNode, bool)
- type GraphNode
- type HEAD
- type Index
- func (index *Index) ClearEntries()
- func (index *Index) Entries() []*IndexEntry
- func (index *Index) Read()
- func (index *Index) Save()
- func (index *Index) WriteEmptyStatEntries(path_names []string, object_ids [][]byte, stages []uint16)
- func (index *Index) WriteEntries(path_names []string, object_ids [][]byte)
- type IndexEntry
- type IndexHeader
- type List
- type Queue
- type ReGit
- type TreeEntry
- type TreeGraph
- type TreeObject
Constants ¶
View Source
const ( White = iota Gray Black )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobObject ¶
type BlobObject struct {
Obj GitObject
}
func NewBlobObject ¶
func NewBlobObject(rootDir string) *BlobObject
func (*BlobObject) CreateFromFile ¶
func (blob *BlobObject) CreateFromFile(filename string)
func (*BlobObject) ReadFromExistingObject ¶
func (blob *BlobObject) ReadFromExistingObject(sha1Name string)
type CommitGraph ¶
type CommitGraph struct {
// contains filtered or unexported fields
}
func NewCommitGraph ¶
func NewCommitGraph(root_commit *CommitObject, rootDir string) *CommitGraph
func (*CommitGraph) LoadAllCommits ¶
func (cg *CommitGraph) LoadAllCommits() []*CommitObject
func (*CommitGraph) PrintCommitLogs ¶
func (cg *CommitGraph) PrintCommitLogs()
type CommitObject ¶
type CommitObject struct {
Obj GitObject
// contains filtered or unexported fields
}
func NewCommitObject ¶
func NewCommitObject(rootDir string) *CommitObject
func (*CommitObject) GenerateContent ¶
func (commit *CommitObject) GenerateContent()
func (*CommitObject) ReadFromExistingObject ¶
func (commit *CommitObject) ReadFromExistingObject(sha1Name string)
func (*CommitObject) SetAuthor ¶
func (commit *CommitObject) SetAuthor(author string)
func (*CommitObject) SetCommitter ¶
func (commit *CommitObject) SetCommitter(committer string)
func (*CommitObject) SetMessage ¶
func (commit *CommitObject) SetMessage(message string)
func (*CommitObject) SetParents ¶
func (commit *CommitObject) SetParents(parents []string)
func (*CommitObject) SetTree ¶
func (commit *CommitObject) SetTree(tree string)
type GitObject ¶
type GitObject struct {
HashedFilename []byte
// contains filtered or unexported fields
}
func (*GitObject) WriteToFile ¶
func (obj *GitObject) WriteToFile()
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
type HEAD ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) ClearEntries ¶
func (index *Index) ClearEntries()
func (*Index) Entries ¶
func (index *Index) Entries() []*IndexEntry
func (*Index) WriteEmptyStatEntries ¶
func (*Index) WriteEntries ¶
type IndexEntry ¶
type IndexEntry struct {
// 32-bit ctime seconds, the last time a file's metadata changed
// this is stat(2) data
Ctime_sec uint32
// 32-bit ctime nanosecond fractions
// this is stat(2) data
Ctime_nanosec uint32
// 32-bit mtime seconds, the last time a file's data changed
// this is stat(2) data
Mtime_sec uint32
// 32-bit mtime nanosecond fractions
// this is stat(2) data
Mtime_nanosec uint32
// 32-bit Dev
// this is stat(2) data
Dev uint32
// 32-bit Ino
// this is stat(2) data
Ino uint32
// 9-bit unix permission. Only 0755 and 0644 are valid for regular files.
// Symbolic links and gitlinks have value 0 in this field.
Mode uint32
// 32-bit Uid
// this is stat(2) data
Uid uint32
// 32-bit Gid
// this is stat(2) data
Gid uint32
// 32-bit file size
// This is the on-disk size from stat(2), truncated to 32-bit.
File_size uint32
// (SHA-1) Object name for the represented object
Obj_name []byte
// 12-bit name length if the length is less than 0xFFF; otherwise 0xFFF
// is stored in this field.
Flags uint16
// The exact encoding is undefined, but the '.' and '/' characters
// are encoded in 7-bit ASCII and the encoding cannot contain a NUL
// byte (iow, this is a UNIX pathname).
Path []byte
}
An index entry typically represents a file. However, if sparse-checkout
is enabled in cone mode (`core.sparseCheckoutCone` is enabled) and the `extensions.sparseIndex` extension is enabled, then the index may contain entries for directories outside of the sparse-checkout definition. These entries have mode `040000`, include the `SKIP_WORKTREE` bit, and the path ends in a directory separator.
func (*IndexEntry) Stage ¶
func (entry *IndexEntry) Stage() uint16
type IndexHeader ¶
type IndexHeader struct {
// contains filtered or unexported fields
}
12-byte header
type ReGit ¶
func (*ReGit) CreateBranch ¶
type TreeGraph ¶
type TreeGraph struct {
// contains filtered or unexported fields
}
An auxiliary data structure for constructing tree objects based on the content of staging area (index)
func NewTreeGraph ¶
func NewTreeGraph() *TreeGraph
func (*TreeGraph) ConstructTreeObjects ¶
type TreeObject ¶
type TreeObject struct {
Obj GitObject
Entries []*TreeEntry
DescendentTrees map[string]*TreeObject
}
func NewTreeObject ¶
func NewTreeObject(rootDir string) *TreeObject
func (*TreeObject) FilePathNames ¶
func (tree *TreeObject) FilePathNames() []string
return all file path names stored by the tree object
func (*TreeObject) FilesSHA1 ¶
func (tree *TreeObject) FilesSHA1() [][]byte
func (*TreeObject) ReadFromExistingObject ¶
func (tree *TreeObject) ReadFromExistingObject(sha1Name string)
func (*TreeObject) RecursiveRead ¶
func (tree *TreeObject) RecursiveRead(sha1Name string)
func (*TreeObject) WriteEntries ¶
func (tree *TreeObject) WriteEntries(entries []*TreeEntry)
Click to show internal directories.
Click to hide internal directories.