Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DELETED if the file is deleted // Deprecated: use FileModeDeleted instead. DELETED = FileModeDeleted // MODIFIED if the file is modified // Deprecated: use FileModeModified instead. MODIFIED = FileModeModified // NEW if the file is created and there is no diff // Deprecated: use FileModeNew instead. NEW = FileModeNew )
View Source
const ( // ADDED if the line is added (shown green in diff) // Deprecated: use DiffLineModeAdded instead. ADDED = DiffLineModeAdded // REMOVED if the line is deleted (shown red in diff) // Deprecated: use DiffLineModeRemoved instead. REMOVED = DiffLineModeRemoved // UNCHANGED if the line is unchanged (not colored in diff) // Deprecated: use DiffLineModeUnchanged instead. UNCHANGED = DiffLineModeUnchanged )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
Diff is the collection of DiffFiles
type DiffFile ¶
type DiffFile struct {
DiffHeader string
Mode FileMode
OrigName string
NewName string
Hunks []*DiffHunk
// SimilarityIndex only valid when the mode is FileModeRenamed, ranging from 0 to 100
SimilarityIndex int
}
DiffFile is the sum of diffhunks and holds the changes of the file features
type DiffHunk ¶
type DiffHunk struct {
HunkHeader string
OrigRange DiffRange
NewRange DiffRange
WholeRange DiffRange
}
DiffHunk is a group of difflines
type DiffLine ¶
type DiffLine struct {
Mode DiffLineMode
Number int
Content string
Position int // the line in the diff
}
DiffLine is the least part of an actual diff
type DiffLineMode ¶
type DiffLineMode rune
DiffLineMode tells the line if added, removed or unchanged
const ( // DiffLineModeAdded if the line is added (shown green in diff) DiffLineModeAdded DiffLineMode = iota // DiffLineModeRemoved if the line is deleted (shown red in diff) DiffLineModeRemoved // DiffLineModeUnchanged if the line is unchanged (not colored in diff) DiffLineModeUnchanged )
type DiffRange ¶
type DiffRange struct {
// starting line number
Start int
// the number of lines the change diffHunk applies to
Length int
// Each line of the hunk range.
Lines []*DiffLine
}
DiffRange contains the DiffLine's
Click to show internal directories.
Click to hide internal directories.