Skip to content

Commit

Permalink
Amend loads prev. msg. even if CWD is outside repo
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
Diego Caraffini committed Aug 1, 2022
1 parent 88720f4 commit add2096
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autoload/magit/git.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit add2096

Please sign in to comment.