summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Krieger <gustavopcassol@gmail.com>2023-07-02 00:52:25 -0300
committerGustavo Krieger <gustavopcassol@gmail.com>2023-07-02 02:07:32 -0300
commit87fe30d50daf522f656891851d50eb790bbff2fc (patch)
treef0f27cec3016519d87093b997a5bbb204837b7ba
parentcff9850374097f60d8bf39290d1dcb2b51ec0c91 (diff)
Bump git-todo-parser
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--pkg/commands/git_commands/commit_loader.go4
-rw-r--r--pkg/utils/rebase_todo.go4
-rw-r--r--vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go14
-rw-r--r--vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go2
-rw-r--r--vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go8
-rw-r--r--vendor/modules.txt2
8 files changed, 19 insertions, 21 deletions
diff --git a/go.mod b/go.mod
index 691c9b1a3..c7c2e09fb 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ require (
github.com/cli/safeexec v1.0.0
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
github.com/creack/pty v1.1.11
- github.com/fsmiamoto/git-todo-parser v0.0.4
+ github.com/fsmiamoto/git-todo-parser v0.0.5
github.com/fsnotify/fsnotify v1.4.7
github.com/gdamore/tcell/v2 v2.6.0
github.com/go-errors/errors v1.4.2
diff --git a/go.sum b/go.sum
index 4f961d11c..cf3f7aab8 100644
--- a/go.sum
+++ b/go.sum
@@ -28,8 +28,8 @@ github.com/fatih/color v1.7.1-0.20180516100307-2d684516a886/go.mod h1:Zm6kSWBoL9
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
-github.com/fsmiamoto/git-todo-parser v0.0.4 h1:fzcGaoAFDHWzJRKw//CSZFrXucsLKplIvOSab3FtWWM=
-github.com/fsmiamoto/git-todo-parser v0.0.4/go.mod h1:B+AgTbNE2BARvJqzXygThzqxLIaEWvwr2sxKYYb0Fas=
+github.com/fsmiamoto/git-todo-parser v0.0.5 h1:Bhzd/vz/6Qm3udfkd6NO9fWfD3TpwR9ucp3N75/J5I8=
+github.com/fsmiamoto/git-todo-parser v0.0.5/go.mod h1:B+AgTbNE2BARvJqzXygThzqxLIaEWvwr2sxKYYb0Fas=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go
index 99119f6aa..4e868ccdc 100644
--- a/pkg/commands/git_commands/commit_loader.go
+++ b/pkg/commands/git_commands/commit_loader.go
@@ -304,7 +304,7 @@ func (self *CommitLoader) getInteractiveRebasingCommits() ([]*models.Commit, err
commits := []*models.Commit{}
- todos, err := todo.Parse(bytes.NewBuffer(bytesContent))
+ todos, err := todo.Parse(bytes.NewBuffer(bytesContent), '#')
if err != nil {
self.Log.Error(fmt.Sprintf("error occurred while parsing git-rebase-todo file: %s", err.Error()))
return nil, nil
@@ -346,7 +346,7 @@ func (self *CommitLoader) getConflictedCommit(todos []todo.Todo) string {
return ""
}
- doneTodos, err := todo.Parse(bytes.NewBuffer(bytesContent))
+ doneTodos, err := todo.Parse(bytes.NewBuffer(bytesContent), '#')
if err != nil {
self.Log.Error(fmt.Sprintf("error occurred while parsing rebase-merge/done file: %s", err.Error()))
return ""
diff --git a/pkg/utils/rebase_todo.go b/pkg/utils/rebase_todo.go
index 15c06b1c4..d0bd92b82 100644
--- a/pkg/utils/rebase_todo.go
+++ b/pkg/utils/rebase_todo.go
@@ -42,7 +42,7 @@ func ReadRebaseTodoFile(fileName string) ([]todo.Todo, error) {
return nil, err
}
- todos, err := todo.Parse(f)
+ todos, err := todo.Parse(f, '#')
err2 := f.Close()
if err == nil {
err = err2
@@ -55,7 +55,7 @@ func WriteRebaseTodoFile(fileName string, todos []todo.Todo) error {
if err != nil {
return err
}
- err = todo.Write(f, todos)
+ err = todo.Write(f, todos, '#')
err2 := f.Close()
if err == nil {
err = err2
diff --git a/vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go b/vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go
index ab3dd9ea9..51efd305d 100644
--- a/vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go
+++ b/vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go
@@ -16,7 +16,7 @@ var (
ErrMissingRef = errors.New("missing ref")
)
-func Parse(f io.Reader) ([]Todo, error) {
+func Parse(f io.Reader, commentChar byte) ([]Todo, error) {
var result []Todo
scanner := bufio.NewScanner(f)
@@ -30,7 +30,7 @@ func Parse(f io.Reader) ([]Todo, error) {
continue
}
- cmd, err := parseLine(line)
+ cmd, err := parseLine(line, commentChar)
if err != nil {
return nil, fmt.Errorf("failed to parse line %q: %w", line, err)
}
@@ -45,12 +45,12 @@ func Parse(f io.Reader) ([]Todo, error) {
return result, nil
}
-func parseLine(line string) (Todo, error) {
+func parseLine(line string, commentChar byte) (Todo, error) {
var todo Todo
- if strings.HasPrefix(line, CommentChar) {
+ if line[0] == commentChar {
todo.Command = Comment
- todo.Comment = strings.TrimLeft(line, CommentChar)
+ todo.Comment = line[1:]
return todo, nil
}
@@ -143,8 +143,8 @@ func parseLine(line string) (Todo, error) {
todo.Commit = fields[0]
fields = fields[1:]
- // Trim # and whitespace
- todo.Msg = strings.TrimPrefix(strings.Join(fields, " "), CommentChar+" ")
+ // Trim comment char and whitespace
+ todo.Msg = strings.TrimPrefix(strings.Join(fields, " "), fmt.Sprintf("%c ", commentChar))
return todo, nil
}
diff --git a/vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go b/vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go
index 77bb5dc71..3b2c45290 100644
--- a/vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go
+++ b/vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go
@@ -23,8 +23,6 @@ const (
Comment
)
-const CommentChar = "#"
-
type Todo struct {
Command TodoCommand
Commit string
diff --git a/vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go b/vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go
index c96b06cc0..949db420a 100644
--- a/vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go
+++ b/vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go
@@ -5,9 +5,9 @@ import (
"strings"
)
-func Write(f io.Writer, todos []Todo) error {
+func Write(f io.Writer, todos []Todo, commentChar byte) error {
for _, todo := range todos {
- if err := writeTodo(f, todo); err != nil {
+ if err := writeTodo(f, todo, commentChar); err != nil {
return err
}
}
@@ -15,7 +15,7 @@ func Write(f io.Writer, todos []Todo) error {
return nil
}
-func writeTodo(f io.Writer, todo Todo) error {
+func writeTodo(f io.Writer, todo Todo, commentChar byte) error {
var sb strings.Builder
if todo.Command != Comment {
sb.WriteString(todo.Command.String())
@@ -26,7 +26,7 @@ func writeTodo(f io.Writer, todo Todo) error {
return nil
case Comment:
- sb.WriteString(CommentChar)
+ sb.WriteByte(commentChar)
sb.WriteString(todo.Comment)
case Break:
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 3012b04de..04937f5b2 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -30,7 +30,7 @@ github.com/emirpasic/gods/utils
# github.com/fatih/color v1.9.0
## explicit; go 1.13
github.com/fatih/color
-# github.com/fsmiamoto/git-todo-parser v0.0.4
+# github.com/fsmiamoto/git-todo-parser v0.0.5
## explicit; go 1.13
github.com/fsmiamoto/git-todo-parser/todo
# github.com/fsnotify/fsnotify v1.4.7