Skip to content

Commit eb7ad15

Browse files
Diego CaraffiniDiego Caraffini
authored andcommitted
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 "git rev-parse --absolute-git-dir". Thanks to user v-slava for suggesting the use of --absolute-git-dir.
1 parent fc7eda9 commit eb7ad15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

autoload/magit/git.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function! magit#git#set_top_dir(path)
7979
try
8080
let top_dir=magit#utils#strip(
8181
\ system(g:magit_git_cmd . " rev-parse --show-toplevel")) . "/"
82-
let git_dir=magit#utils#strip(system(g:magit_git_cmd . " rev-parse --git-dir")) . "/"
82+
let git_dir=magit#utils#strip(system(g:magit_git_cmd . " rev-parse --absolute-git-dir")) . "/"
8383
if ( executable("cygpath") )
8484
let top_dir = magit#utils#strip(system("cygpath " . top_dir))
8585
let git_dir = magit#utils#strip(system("cygpath " . git_dir))

0 commit comments

Comments
 (0)