Documentation
¶
Index ¶
- Constants
- func SeparateLines(fragment *gitdiff.TextFragment) ([]SplitLine, []SplitLine)
- type AncestorCheckResponse
- type Branch
- type Capabilities
- type Commit
- type ConflictInfo
- type Diff
- type DiffFileName
- type DiffFileRenderer
- type DiffFileStat
- type DiffOpts
- type DiffRenderer
- type DiffStat
- type DiffTree
- type ForkInfo
- type ForkStatus
- type FormatPatch
- type LastCommitInfo
- type MergeCheckResponse
- type MergeRequest
- type NiceDiff
- type NiceTree
- type Reference
- type RepoBranchResponse
- type RepoBranchesResponse
- type RepoCommitResponse
- type RepoDefaultBranchResponse
- type RepoFormatPatchResponse
- type RepoIndexResponse
- type RepoLanguageDetails
- type RepoLanguageResponse
- type RepoLogResponse
- type RepoTagResponse
- type RepoTagsResponse
- type RepoTreeResponse
- type SplitDiff
- type SplitFragment
- type SplitLine
- type TagReference
Constants ¶
const ( UpToDate ForkStatus = 0 FastForwardable = 1 Conflict = 2 MissingBranch = 3 )
Variables ¶
This section is empty.
Functions ¶
func SeparateLines ¶
func SeparateLines(fragment *gitdiff.TextFragment) ([]SplitLine, []SplitLine)
separate lines into left and right, this includes additional logic to group consecutive runs of additions and deletions in order to align them properly in the final output
TODO: move all diff stuff to a single package, we are spread across patchutil and types right now
Types ¶
type AncestorCheckResponse ¶
type AncestorCheckResponse struct {
Status ForkStatus `json:"status"`
}
type Branch ¶
type Capabilities ¶
type Commit ¶
type Commit struct {
// hash of the commit object.
Hash plumbing.Hash `json:"hash,omitempty"`
// author is the original author of the commit.
Author object.Signature `json:"author"`
// committer is the one performing the commit, might be different from author.
Committer object.Signature `json:"committer"`
// message is the commit message, contains arbitrary text.
Message string `json:"message"`
// treehash is the hash of the root tree of the commit.
Tree string `json:"tree"`
// parents are the hashes of the parent commits of the commit.
ParentHashes []plumbing.Hash `json:"parent_hashes,omitempty"`
// pgpsignature is the pgp signature of the commit.
PGPSignature string `json:"pgp_signature,omitempty"`
// mergetag is the embedded tag object when a merge commit is created by
// merging a signed tag.
MergeTag string `json:"merge_tag,omitempty"`
// changeid is a unique identifier for the change (e.g., gerrit change-id).
ChangeId string `json:"change_id,omitempty"`
// extraheaders contains additional headers not captured by other fields.
ExtraHeaders map[string][]byte `json:"extra_headers,omitempty"`
// deprecated: kept for backwards compatibility with old json format.
This string `json:"this,omitempty"`
// deprecated: kept for backwards compatibility with old json format.
Parent string `json:"parent,omitempty"`
}
func (*Commit) FromGoGitCommit ¶
fill in as much of Commit as possible from the given go-git commit
func (*Commit) Payload ¶
produce a verifiable payload from this commit's metadata
func (*Commit) UnmarshalJSON ¶
types.Commit is an unify two commit structs:
- git.object.Commit from
- types.NiceDiff.commit
to do this in backwards compatible fashion, we define the base struct to use the same fields as NiceDiff.Commit, and then we also unmarshal the struct fields from go-git structs, this custom unmarshal makes sense of both representations and unifies them to have maximal data in either form.
type ConflictInfo ¶
type Diff ¶
type Diff struct {
Name struct {
Old string `json:"old"`
New string `json:"new"`
} `json:"name"`
TextFragments []gitdiff.TextFragment `json:"text_fragments"`
IsBinary bool `json:"is_binary"`
IsNew bool `json:"is_new"`
IsDelete bool `json:"is_delete"`
IsCopy bool `json:"is_copy"`
IsRename bool `json:"is_rename"`
}
func (Diff) Names ¶
func (d Diff) Names() DiffFileName
func (Diff) Stats ¶
func (d Diff) Stats() DiffFileStat
type DiffFileRenderer ¶
type DiffFileRenderer interface {
// html ID for each file in the diff
Id() string
// produce a splitdiff
Split() SplitDiff
// stats for this single file
Stats() DiffFileStat
// old and new name of file
Names() DiffFileName
// whether this diff can be displayed,
// returns a reason if not, and the empty string if it can
CanRender() string
}
type DiffRenderer ¶
type DiffRenderer interface {
// list of file affected by these diffs
ChangedFiles() []DiffFileRenderer
// filetree
FileTree() *filetree.FileTreeNode
Stats() DiffStat
}
type DiffStat ¶
type DiffTree ¶
type ForkInfo ¶
type ForkInfo struct {
IsFork bool
Status ForkStatus
}
type FormatPatch ¶
type FormatPatch struct {
Files []*gitdiff.File
*gitdiff.PatchHeader
Raw string
}
func (FormatPatch) ChangeId ¶
func (f FormatPatch) ChangeId() (string, error)
type LastCommitInfo ¶
type MergeCheckResponse ¶
type MergeCheckResponse struct {
IsConflicted bool `json:"is_conflicted"`
Conflicts []ConflictInfo `json:"conflicts"`
Message string `json:"message"`
Error string `json:"error"`
}
type MergeRequest ¶
type NiceDiff ¶
type NiceDiff struct {
Commit Commit `json:"commit"`
Stat DiffStat `json:"stat"`
Diff []Diff `json:"diff"`
}
A nicer git diff representation.
func (NiceDiff) ChangedFiles ¶
func (d NiceDiff) ChangedFiles() []DiffFileRenderer
func (NiceDiff) FileTree ¶
func (d NiceDiff) FileTree() *filetree.FileTreeNode
type NiceTree ¶
type NiceTree struct {
// Relative path
Name string `json:"name"`
Mode string `json:"mode"`
Size int64 `json:"size"`
LastCommit *LastCommitInfo `json:"last_commit,omitempty"`
}
A nicer git tree representation.
type RepoBranchesResponse ¶
type RepoBranchesResponse struct {
Branches []Branch `json:"branches,omitempty"`
}
type RepoCommitResponse ¶
type RepoDefaultBranchResponse ¶
type RepoDefaultBranchResponse struct {
Branch string `json:"branch,omitempty"`
}
type RepoFormatPatchResponse ¶
type RepoFormatPatchResponse struct {
Rev1 string `json:"rev1,omitempty"`
Rev2 string `json:"rev2,omitempty"`
FormatPatch []FormatPatch `json:"format_patch,omitempty"`
FormatPatchRaw string `json:"patch,omitempty"`
CombinedPatch []*gitdiff.File `json:"combined_patch,omitempty"`
CombinedPatchRaw string `json:"combined_patch_raw,omitempty"`
}
type RepoIndexResponse ¶
type RepoIndexResponse struct {
IsEmpty bool `json:"is_empty"`
Ref string `json:"ref,omitempty"`
Readme string `json:"readme,omitempty"`
ReadmeFileName string `json:"readme_file_name,omitempty"`
Commits []Commit `json:"commits,omitempty"`
Description string `json:"description,omitempty"`
Files []NiceTree `json:"files,omitempty"`
Branches []Branch `json:"branches,omitempty"`
Tags []*TagReference `json:"tags,omitempty"`
TotalCommits int `json:"total_commits,omitempty"`
}
type RepoLanguageDetails ¶
type RepoLanguageResponse ¶
type RepoLogResponse ¶
type RepoTagResponse ¶
type RepoTagResponse struct {
Tag *TagReference `json:"tag,omitempty"`
}
type RepoTagsResponse ¶
type RepoTagsResponse struct {
Tags []*TagReference `json:"tags,omitempty"`
}
type RepoTreeResponse ¶
type RepoTreeResponse struct {
Ref string `json:"ref,omitempty"`
Parent string `json:"parent,omitempty"`
Description string `json:"description,omitempty"`
DotDot string `json:"dotdot,omitempty"`
Files []NiceTree `json:"files,omitempty"`
ReadmeFileName string `json:"readme_filename,omitempty"`
Readme string `json:"readme_contents,omitempty"`
}
type SplitDiff ¶
type SplitDiff struct {
Name string `json:"name"`
TextFragments []SplitFragment `json:"fragments"`
}
type SplitFragment ¶
type SplitLine ¶
Source Files
¶
- capabilities.go
- commit.go
- diff.go
- diff_renderer.go
- merge.go
- patch.go
- repo.go
- split.go
- tree.go