diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-31 23:55:06 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-02 11:00:15 +1100 |
commit | 7d62f103e4a1b39b7e8fbd0e1f39815c525cd588 (patch) | |
tree | 83e331beeee07d066c76580e044234f18063a0a7 /pkg/commands/patch | |
parent | 9e85d37fb949bbc83f28cb079f2ac4b45ae895ce (diff) |
big refactor to give our enums actual types
Diffstat (limited to 'pkg/commands/patch')
-rw-r--r-- | pkg/commands/patch/patch_parser.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/commands/patch/patch_parser.go b/pkg/commands/patch/patch_parser.go index 55554fec3..00eafd995 100644 --- a/pkg/commands/patch/patch_parser.go +++ b/pkg/commands/patch/patch_parser.go @@ -10,8 +10,10 @@ import ( "github.com/sirupsen/logrus" ) +type PatchLineKind int + const ( - PATCH_HEADER = iota + PATCH_HEADER PatchLineKind = iota COMMIT_SHA COMMIT_DESCRIPTION HUNK_HEADER @@ -24,7 +26,7 @@ const ( // the job of this file is to parse a diff, find out where the hunks begin and end, which lines are stageable, and how to find the next hunk from the current position or the next stageable line from the current position. type PatchLine struct { - Kind int + Kind PatchLineKind Content string // something like '+ hello' (note the first character is not removed) } @@ -144,7 +146,7 @@ func parsePatch(patch string) ([]int, []int, []*PatchLine, error) { pastFirstHunkHeader := false pastCommitDescription := true patchLines := make([]*PatchLine, len(lines)) - var lineKind int + var lineKind PatchLineKind var firstChar string for index, line := range lines { firstChar = " " |