Documentation ¶
Index ¶
- Variables
- func Branch(gitRepoPath string, reader repository.FileReader) (string, error)
- func Checkout(gitRepoPath string, branchName string, objPath string, ...) error
- func CommitTree(commit Commit, path string, fileFormatter repository.GitFileFormatter, ...) (*repository.SerializedGitObject, error)
- func DefaultGitUserAsJson() ([]byte, error)
- func GitCat(hash repository.Hash, fileFormatter repository.GitFileFormatter, ...) (*repository.DeserializedGitObject, error)
- func Log(writer *tablewriter.Table, gitRepoPath string, ...) error
- func UpdateIndex(index repository.IndexEntry, indexPath string) error
- func UpdateRef(hash repository.Hash, writer io.Writer, objPath string, ...) error
- func WriteTree(indexLines []string, objPath string, gitFormatter repository.GitFileFormatter) (*repository.SerializedGitObject, error)
- type Commit
- type Time
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var Git struct { Init struct { } `cmd help:"Init empty repository"` Add struct { Files []string `arg name:"files" help:"files to add" type:"path"` } `cmd help:"Add files."` HashObject struct { Write bool `help:"Save the object" short:"w"` Type string `help:"Type of object" enum:"blob,tree" default:"blob"` File string `arg name:"file" help:"path to file to generate hash from" type :"path"` } `cmd help:"Creates a hash of a given file"` CatFile struct { Hash string `arg name:"hash" help:"object hash"` } `cmd help:"Print the content of a blob by hash"` UpdateIndex struct { Hash string `arg name:"hash" help:"hash" ` File string `arg name:"file" help:"path to file to save in index" ` Mode string `arg name:"mode" help:"file mode" enum:"100644,100755" default"100644"` } `cmd help:"Update index"` LsTree struct { } `cmd help:"Print index content"` WriteTree struct { } `cmd help:"Create a tree object from index file"` CommitTree struct { Message string `help:"Commit message" short:"m" required:""` Parent string ` help:"hash of a parent commit" short:"p" default:"" ` Hash string `arg name:"hash" help:"hash of a tree object" ` } `cmd help:"Create a commit object"` UpdateRef struct { Name string `help:"Name of a branch" arg name:"name"` Hash string `help:"Hash of a tree object" arg name:"hash"` } `cmd help:"Create a new branch"` Checkout struct { Branch string `arg name:"branch" help:"Name of a branch to checkout"` } `cmd help:"Checkout a given branch"` Branch struct { } `cmd help:"Print current branch"` Log struct { } `cmd help:"Print the list of commits with messages"` }
Functions ¶
func Branch ¶
func Branch( gitRepoPath string, reader repository.FileReader, ) (string, error)
func Checkout ¶
func Checkout( gitRepoPath string, branchName string, objPath string, reader repository.FileReader, objReader repository.ObjectReader, formatter repository.GitFileFormatter, ) error
func CommitTree ¶
func CommitTree( commit Commit, path string, fileFormatter repository.GitFileFormatter, reader repository.FileReader, ) (*repository.SerializedGitObject, error)
Create a commit object This method does a validation and then delegates an actual commit creation to #createCommitTree
func DefaultGitUserAsJson ¶
func GitCat ¶
func GitCat( hash repository.Hash, fileFormatter repository.GitFileFormatter, objPath string, reader repository.FileReader, ) (*repository.DeserializedGitObject, error)
cat object by given hash
func Log ¶
func Log( writer *tablewriter.Table, gitRepoPath string, formatter repository.GitFileFormatter, reader repository.FileReader, objReader repository.ObjectReader, ) error
func UpdateIndex ¶
func UpdateIndex(index repository.IndexEntry, indexPath string) error
Adds a new entry into an index file
func UpdateRef ¶
func UpdateRef( hash repository.Hash, writer io.Writer, objPath string, reader repository.FileReader, formatter repository.GitFileFormatter, ) error
creates a new branch
func WriteTree ¶
func WriteTree( indexLines []string, objPath string, gitFormatter repository.GitFileFormatter, ) (*repository.SerializedGitObject, error)
create a tree object from entries saved in index
Types ¶
type Commit ¶
type Commit struct {
// contains filtered or unexported fields
}
func NewCommit ¶
func NewCommit( hash repository.Hash, message string, parent repository.Hash, user *User, time *Time, ) *Commit
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
func CurrentTime ¶
func CurrentTime() *Time
Click to show internal directories.
Click to hide internal directories.