From add209668d1a9babb0f866e9e253d1fef3be6c24 Mon Sep 17 00:00:00 2001 From: Diego Caraffini Date: Sun, 31 Jul 2022 23:38:11 -0400 Subject: [PATCH] Amend loads prev. msg. even if CWD is outside repo The path to the ".git" directory returned by git rev-parse --git-dir and stored in "b:magit_git_dir", can be a relative one, which would not work for opening file "COMMIT_EDITMSG" when the currently edited file was opened from outside the repository, so we make "b:magit_git_dir" absolute via "fnamemodify". --- autoload/magit/git.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/magit/git.vim b/autoload/magit/git.vim index 0705b7e..980de71 100644 --- a/autoload/magit/git.vim +++ b/autoload/magit/git.vim @@ -84,7 +84,7 @@ function! magit#git#set_top_dir(path) throw 'set_top_dir_error' endtry let b:magit_top_dir=top_dir - let b:magit_git_dir=git_dir + let b:magit_git_dir=fnamemodify(git_dir, ':p') finally call magit#utils#chdir(dir) endtry