I call git get the toplevel dir (according to Is there a way to get the git root directory in one command? ).
(let ((tmpbuffer (get-buffer-create (make-temp-
I think you can do
(replace-regexp-in-string "\n$" "" (shell-command-to-string "git rev-parse --show-toplevel"))