Documentation
¶
Index ¶
- func ClearStoredHead(repoPath string) error
- func Close(r *Repository) error
- func ConflictedFiles(r *Repository) ([]string, error)
- func GetFileAtCommit(r *Repository, commitSHA string, filePath string) ([]byte, error)
- func GetStoredHead(repoPath string) (string, error)
- func IsConflicted(r *Repository, filePath string) (bool, error)
- func ListChangedFiles(r *Repository, commitSHA string) ([]string, error)
- func MarkResolved(r *Repository, filePath string) error
- func ScanForMarkers(repoPath string) ([]string, error)
- func StoreHead(repoPath string, head string) error
- type Commit
- type Hunk
- type HunkKind
- type Repository
- type TreeEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearStoredHead ¶
func ConflictedFiles ¶
func ConflictedFiles(r *Repository) ([]string, error)
func GetFileAtCommit ¶
func GetFileAtCommit(r *Repository, commitSHA string, filePath string) ([]byte, error)
GetFileAtCommit : returns the raw content of a file as it existed at a specific commit this is the most important function in this file for conflict resolution conflict/classifier.go calls this to get the three versions of a conflicted file: base version, our version, their version
func GetStoredHead ¶
func IsConflicted ¶
func IsConflicted(r *Repository, filePath string) (bool, error)
func ListChangedFiles ¶
func ListChangedFiles(r *Repository, commitSHA string) ([]string, error)
ListChangedFiles returns which files were modified in a given commit compared to its parent commit index.go uses this to know which files need conflict checking
func MarkResolved ¶
func MarkResolved(r *Repository, filePath string) error
func ScanForMarkers ¶ added in v1.1.1
Types ¶
type Commit ¶
type Commit struct {
SHA string
Tree string
Parent string
Author string
Message string
Time string
}
Commit represents a single git commit object uppercase fields = public, other packages can read them
func GetCommit ¶
func GetCommit(r *Repository, sha string) (Commit, error)
GetCommit fetches and parses a commit object by its SHA every other package in gitresolve calls this to read commit history
func GetParentCommit ¶
func GetParentCommit(r *Repository, sha string) (Commit, error)
GetParentCommit fetches the commit that came before the given commit merge/base.go uses this to walk backwards through history to find the merge base
type Hunk ¶
type Hunk struct {
StartLine int
EndLine int
Kind HunkKind
BaseLines []string
OurLines []string
TheirLines []string
}
Hunk is one region of change between file versions
func ThreeWayDiff ¶
ThreeWayDiff compares base/ours/theirs and returns all changed regions this function splits content into lines and orchestrates the comparison
type Repository ¶
type Repository struct {
Path string
// contains filtered or unexported fields
}
func Open ¶
func Open(path string) (*Repository, error)
opening git repo at given path and aquire lock.
func (*Repository) HeadCommit ¶
func (r *Repository) HeadCommit() (string, error)
fetching sha of head commit
func (*Repository) IsClean ¶
func (r *Repository) IsClean() (bool, error)
checking if the working directory has no uncommitted changes useful to warn the user before gitresolve starts modifying files
func (*Repository) ResetHardTo ¶
func (r *Repository) ResetHardTo(commitSHA string) error