Documentation
¶
Index ¶
- func ElideUnifiedDiff(diff string, contextLines int) string
- func GenerateElidedUnifiedDiff(oldContent, newContent []byte, filename string, contextLines int) string
- type DiffLine
- type DiffLineType
- type FileCache
- func (fc *FileCache) Cleanup()
- func (fc *FileCache) GenerateDiff(pid uint32, fd int32, pathHash uint32, offset uint64, newContent []byte) (string, bool)
- func (fc *FileCache) GenerateUnifiedDiff(pid uint32, fd int32, pathHash uint32, offset uint64, newContent []byte, ...) (string, bool)
- func (fc *FileCache) GetContentForDiff(pid uint32, fd int32, pathHash uint32, offset uint64) (*FileContent, bool)
- func (fc *FileCache) Size() int
- func (fc *FileCache) StoreReadContent(pid uint32, fd int32, pathHash uint32, content []byte, offset uint64)
- func (fc *FileCache) UpdateWriteContent(pid uint32, fd int32, pathHash uint32, content []byte, offset uint64)
- type FileContent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElideUnifiedDiff ¶
ElideUnifiedDiff takes a unified diff and limits context lines around changes
Types ¶
type DiffLine ¶
type DiffLine struct { Type DiffLineType // Type of line (add, remove, context) Content string // Content of the line OldLine int // Line number in old file (0 if not applicable) NewLine int // Line number in new file (0 if not applicable) }
DiffLine represents a single line in a diff with its type
func ParseUnifiedDiff ¶
ParseUnifiedDiff parses a unified diff into structured diff lines with line numbers
type DiffLineType ¶
type DiffLineType int
DiffLineType represents the type of a diff line
const ( DiffLineContext DiffLineType = iota // Unchanged line DiffLineAdd // Added line (+) DiffLineRemove // Removed line (-) DiffLineHeader // File header (---, +++) DiffLineLocation // Hunk header (@@) DiffLineElided // Elided content marker (...) )
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
FileCache caches file contents for diff generation
func (*FileCache) Cleanup ¶
func (fc *FileCache) Cleanup()
Cleanup removes old entries from the cache
func (*FileCache) GenerateDiff ¶
func (fc *FileCache) GenerateDiff(pid uint32, fd int32, pathHash uint32, offset uint64, newContent []byte) (string, bool)
GenerateDiff compares cached content with new write content
func (*FileCache) GenerateUnifiedDiff ¶
func (fc *FileCache) GenerateUnifiedDiff(pid uint32, fd int32, pathHash uint32, offset uint64, newContent []byte, filename string) (string, bool)
GenerateUnifiedDiff generates a unified diff format
func (*FileCache) GetContentForDiff ¶
func (fc *FileCache) GetContentForDiff(pid uint32, fd int32, pathHash uint32, offset uint64) (*FileContent, bool)
GetContentForDiff retrieves cached content for diff comparison
Click to show internal directories.
Click to hide internal directories.