gbprod / tree-sitter-gitcommit

A tree-sitter grammar for gitcommit messages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: Error in parsing commitmsg with dirty submodule

thatlittleboy opened this issue · comments

Description

The current parser doesn't support dirty submodules. It errors out. See example below.

Steps to Reproduce

  1. Run the following command to generate a test file
$ cat << EOF > a.COMMIT_EDITMSG
feat(vim): some title text

This commit_editmsg comes from a real life example, in a repository containing a
dirty submodule.
#
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is ahead of 'origin/master' by 8 commits.
#   (use "git push" to publish your local commits)
#
# Changes to be committed:
#	modified:   ../../../.config/nvim/after/ftplugin/markdown.vim
#
# Changes not staged for commit:
#	modified:   ../../../.config/nvim/lua/xkcd/plugins/nvim-tree.lua
#	modified:   ../../../.config/setup-scripts-submodule (modified content)

# vim: ft=gitcommit:noexpandtab
EOF

The offending line is the final modified line, above the vim modeline.

  1. Then tree-sitter parse a.COMMIT_EDITMSG to run the query or via neovim treesitter Playground, you can see the errors highlighted in red.

Expected output

No error when parsing.

commented

Good catch, I try to fix it soon !

commented

Fixed

Thanks. I'll check it after merging into nvim-treesitter.

Works!