{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gitdiff\n\n## Constants\n\n```go\nconst BlobExcerptChunkSize = 20\n```\nBlobExcerptChunkSize represent max lines of excerpt\n\n## Functions\n\n```go\nfunc GetWhitespaceFlag(whiteSpaceBehavior string) string\n```\nGetWhitespaceFlag returns git diff flag for treating whitespaces\n\n## Types\n\n```go\ntype Diff struct {\n\tNumFiles, TotalAddition, TotalDeletion int\n\tFiles                                  []*DiffFile\n\tIsIncomplete                           bool\n}\n```\nDiff represents a difference between two git trees.\n\n```go\nfunc CommentAsDiff(c *models.Comment) (*Diff, error)\n```\nCommentAsDiff returns c.Patch as \\*Diff\n\n```go\nfunc CommentMustAsDiff(c *models.Comment) *Diff\n```\nCommentMustAsDiff executes AsDiff and logs the error instead of returning\n\n```go\nfunc GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)\n```\nGetDiffCommit builds a Diff representing the given commitID.\n\n```go\nfunc GetDiffCommitWithWhitespaceBehavior(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int, whitespaceBehavior string) (*Diff, error)\n```\nGetDiffCommitWithWhitespaceBehavior builds a Diff representing the given commitID. The whitespaceBehavior is either an empty string or a git flag\n\n```go\nfunc GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)\n```\nGetDiffRange builds a Diff between two commits of a repository. passing the empty string as beforeCommitID returns a diff from the parent commit.\n\n```go\nfunc GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int, whitespaceBehavior string) (*Diff, error)\n```\nGetDiffRangeWithWhitespaceBehavior builds a Diff between two commits of a repository. Passing the empty string as beforeCommitID returns a diff from the parent commit. The whitespaceBehavior is either an empty string or a git flag\n\n```go\nfunc ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error)\n```\nParsePatch builds a Diff object from a io.Reader and some parameters.\n\n```go\nfunc (diff *Diff) LoadComments(issue *models.Issue, currentUser *models.User) error\n```\nLoadComments loads comments into each line\n\n```go\ntype DiffFile struct {\n\tName               string\n\tOldName            string\n\tIndex              int\n\tAddition, Deletion int\n\tType               DiffFileType\n\tIsCreated          bool\n\tIsDeleted          bool\n\tIsBin              bool\n\tIsLFSFile          bool\n\tIsRenamed          bool\n\tIsAmbiguous        bool\n\tIsSubmodule        bool\n\tSections           []*DiffSection\n\tIsIncomplete       bool\n\tIsProtected        bool\n}\n```\nDiffFile represents a file diff.\n\n```go\nfunc (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, rightCommitID string) *DiffSection\n```\nGetTailSection creates a fake DiffLineSection if the last section is not the end of the file\n\n```go\nfunc (diffFile *DiffFile) GetType() int\n```\nGetType returns type of diff file.\n\n```go\ntype DiffFileType uint8\n```\nDiffFileType represents the type of a DiffFile.\n\n```go\nconst (\n\tDiffFileAdd DiffFileType = iota + 1\n\tDiffFileChange\n\tDiffFileDel\n\tDiffFileRename\n\tDiffFileCopy\n)\n```\nDiffFileType possible values.\n\n```go\ntype DiffLine struct {\n\tLeftIdx     int\n\tRightIdx    int\n\tType        DiffLineType\n\tContent     string\n\tComments    []*models.Comment\n\tSectionInfo *DiffLineSectionInfo\n}\n```\nDiffLine represents a line difference in a DiffSection.\n\n```go\nfunc (d *DiffLine) CanComment() bool\n```\nCanComment returns whether or not a line can get commented\n\n```go\nfunc (d *DiffLine) GetBlobExcerptQuery() string\n```\nGetBlobExcerptQuery builds query string to get blob excerpt\n\n```go\nfunc (d *DiffLine) GetCommentSide() string\n```\nGetCommentSide returns the comment side of the first comment, if not set returns empty string\n\n```go\nfunc (d *DiffLine) GetExpandDirection() DiffLineExpandDirection\n```\nGetExpandDirection gets DiffLineExpandDirection\n\n```go\nfunc (d *DiffLine) GetLineTypeMarker() string\n```\nGetLineTypeMarker returns the line type marker\n\n```go\nfunc (d *DiffLine) GetType() int\n```\nGetType returns the type of a DiffLine.\n\n```go\ntype DiffLineExpandDirection uint8\n```\nDiffLineExpandDirection represents the DiffLineSection expand direction\n\n```go\nconst (\n\tDiffLineExpandNone DiffLineExpandDirection = iota + 1\n\tDiffLineExpandSingle\n\tDiffLineExpandUpDown\n\tDiffLineExpandUp\n\tDiffLineExpandDown\n)\n```\nDiffLineExpandDirection possible values.\n\n```go\ntype DiffLineSectionInfo struct {\n\tPath          string\n\tLastLeftIdx   int\n\tLastRightIdx  int\n\tLeftIdx       int\n\tRightIdx      int\n\tLeftHunkSize  int\n\tRightHunkSize int\n}\n```\nDiffLineSectionInfo represents diff line section meta data\n\n```go\ntype DiffLineType uint8\n```\nDiffLineType represents the type of a DiffLine.\n\n```go\nconst (\n\tDiffLinePlain DiffLineType = iota + 1\n\tDiffLineAdd\n\tDiffLineDel\n\tDiffLineSection\n)\n```\nDiffLineType possible values.\n\n```go\ntype DiffSection struct {\n\tFileName string\n\tName     string\n\tLines    []*DiffLine\n}\n```\nDiffSection represents a section of a DiffFile.\n\n```go\nfunc (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) template.HTML\n```\nGetComputedInlineDiffFor computes inline diff for the given line.\n\n```go\nfunc (diffSection *DiffSection) GetLine(lineType DiffLineType, idx int) *DiffLine\n```\nGetLine gets a specific line by type (add or del) and file line number\n\n","path":"github.com/RedAFD/code-core/services/gitdiff","name":"gitdiff","synopsis":"","isRedistributable":true}
