rhysd / git-messenger.vim

Vim and Neovim plugin to reveal the commit messages under the cursor
MIT License
1.34k stars 32 forks source link

Worktree inside main repository causes an error #48

Closed rhysd closed 4 years ago

rhysd commented 4 years ago

Repro

git init .
echo foo > a.txt
git add a.txt
git commit -m init
git checkout -b other
git checkout -
git worktree add work other

Then open work/a.txt and run :GitMessenger

Expected behavior

Show the 'init' commit

Actual behavior

Cause an error as follows:

git-messenger: fatal: no such path 'work/a.txt' in HEAD: `git --no-pager blame /Users/rhysd/Tmp/foo/work/a.txt -L 1,+1 --porcelain` exited with non-zero status 128

Note: This is not related to #37 but I found this bug while debugging the issue.

rhysd commented 4 years ago

Fixed at 800f055fe4a2333584be5dc74b0867b8aad6baab