lambdalisue / vim-gita

[Obsolete] An awesome git handling plugin for Vim
Other
226 stars 8 forks source link

Error on commit-amend when commit-message includes modeline specifier #137

Closed ichizok closed 8 years ago

ichizok commented 8 years ago

Summary (required)

When commit-message includes modeline specifier (vim:), Gita-commit-amend gets an error.

Behavior (required)

Vim tries to treat commit-message vim: as modeline, therefore it causes E518 error.

Minimal vimrc (required)

if has('vim_starting')
  set runtimepath+=/path/to/vim-gita
endif

Procedure (required)

terminal:

$ cat vimrc
if has('vim_starting')
  set runtimepath+=/path/to/vim-gita
endif
$ git init testrepo
$ cd testrepo
$ echo hello >file
$ git add file
$ git commit -m'vim: commit'
$ vim -Nu ../vimrc

vim:

:Gita commit <C-c><C-a>

Error detected while processing function gita#content#autocmd[7]..gita#content#commit#autocmd[5]..<SNR>36_on_BufReadCmd[25]..gita#util#doautocmd:
line   25:
E518: Unknown option: commit

:wq Do you want to commit changes? (y[es]/n[o]): y<CR>

OK: git -c color.ui=false --no-pager -C /tmp/testrepo commit --verbose --amend --file=/tmp/vy68NIk/5
[master 995f86b] vim: commit
 Date: Tue Nov 1 20:12:14 2016 +0900
 1 file changed, 1 insertion(+)
 create mode 100644 file
Error detected while processing function gita#content#autocmd[7]..gita#content#commit#autocmd[5]..<SNR>36_on_BufReadCmd[25]..gita#util#doautocmd:
line   25:
E518: Unknown option: commit

Remarks

I think it is better to set nomodeline to commit-buffer.

lambdalisue commented 8 years ago

Thanks for the report. Does issue137 branch solve the issue?

ichizok commented 8 years ago

Thank you, I confirmed the fix.

lambdalisue commented 8 years ago

Thanks! The fix has merged :+1: