Skip to content

bug: Error in parsing commitmsg with dirty submodule #10

@thatlittleboy

Description

@thatlittleboy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions