Skip to content

Commit add2096

Browse files
author
Diego Caraffini
committed
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".
1 parent 88720f4 commit add2096

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

autoload/magit/git.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function! magit#git#set_top_dir(path)
8484
throw 'set_top_dir_error'
8585
endtry
8686
let b:magit_top_dir=top_dir
87-
let b:magit_git_dir=git_dir
87+
let b:magit_git_dir=fnamemodify(git_dir, ':p')
8888
finally
8989
call magit#utils#chdir(dir)
9090
endtry

0 commit comments

Comments
 (0)