{"modulePath":"github.com/speakeasy-api/git-diff-parser","version":"v0.0.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pkg\n\n## Functions\n\n```go\nfunc SignificantChange(diff string, isSignificant func(*FileDiff, *ContentChange) (bool, string)) (bool, error, string)\n```\nSignificantChange Allows a structured diff to be passed into the \\`isSignificant\\` function to determine significance. That function can return a message, which is optionally passed as the final argument Returns the first significant change found, or false if non found.\n\n## Types\n\n```go\ntype BinaryDeltaType string\n```\n\n```go\nconst (\n\tBinaryDeltaTypeLiteral BinaryDeltaType = \"literal\"\n\tBinaryDeltaTypeDelta   BinaryDeltaType = \"delta\"\n)\n```\n\n```go\ntype BinaryPatch struct {\n\tType    BinaryDeltaType `json:\"type\"`\n\tCount   int\n\tContent string\n}\n```\n\n```go\ntype ChangeList []ContentChange\n```\n\n```go\nfunc (changes *ChangeList) IsSignificant() bool\n```\n\n```go\ntype ContentChange struct {\n\tType ContentChangeType `json:\"type\"`\n\tFrom string            `json:\"from\"`\n\tTo   string            `json:\"to\"`\n}\n```\nContentChange is a part of the line that starts with \\` \\`, \\`-\\`, \\`+\\` Consecutive ContentChange build a line. A \\`~\\` is a special case of ContentChange that is used to indicate a new line.\n\n```go\ntype ContentChangeType string\n```\n\n```go\nconst (\n\tContentChangeTypeAdd    ContentChangeType = \"add\"\n\tContentChangeTypeDelete ContentChangeType = \"delete\"\n\tContentChangeTypeModify ContentChangeType = \"modify\"\n\tContentChangeTypeNOOP   ContentChangeType = \"\"\n)\n```\n\n```go\ntype Diff struct {\n\tFileDiff []FileDiff `json:\"file_diff\"`\n}\n```\n\n```go\nfunc Parse(diff string) (Diff, []error)\n```\nConverts git diff --word-diff=porcelain output to a Diff object\n\n```go\ntype FileDiff struct {\n\tFromFile   string        `json:\"from_file\"`\n\tToFile     string        `json:\"to_file\"`\n\tType       FileDiffType  `json:\"type\"`\n\tIsBinary   bool          `json:\"is_binary\"`\n\tNewMode    string        `json:\"new_mode\"`\n\tHunks      []Hunk        `json:\"hunks\"`\n\tBinaryHunk []BinaryPatch `json:\"binary_patch\"`\n}\n```\nSource of truth: [https://github.com/git/git/blob/master/diffcore.h#L106](https://github.com/git/git/blob/master/diffcore.h#L106) Implemented in [https://github.com/git/git/blob/master/diff.c#L3496](https://github.com/git/git/blob/master/diff.c#L3496)\n\n```go\ntype FileDiffType string\n```\n\n```go\nconst (\n\tFileDiffTypeAdded    FileDiffType = \"add\"\n\tFileDiffTypeDeleted  FileDiffType = \"delete\"\n\tFileDiffTypeModified FileDiffType = \"modify\"\n)\n```\n\n```go\ntype Hunk struct {\n\tChange             ChangeList `json:\"content_change\"`\n\tStartLineNumberOld int        `json:\"start_old\"`\n\tCountOld           int        `json:\"count_old\"`\n\tStartLineNumberNew int        `json:\"start_new\"`\n\tCountNew           int        `json:\"count_new\"`\n}\n```\nHunk is a line that starts with @@. Each hunk shows one area where the files differ Unified format hunks look like this: @@ from-file-line-numbers to-file-line-numbers @@\n\n\tline-from-either-file\n\tline-from-either-file…\n\nIf a hunk contains just one line, only its start line number appears. Otherwise its line numbers look like ‘start,count’. An empty hunk is considered to start at the line that follows the hunk.\n\n```go\nfunc NewHunk(line string) (Hunk, error)\n```\n\n```go\ntype ParserMode int\n```\n\n","path":"github.com/speakeasy-api/git-diff-parser/pkg","name":"pkg","synopsis":"","isRedistributable":true}
