I'm having a little trouble with magit and the default-directory
variable.
When calling M-x magit-status
, an exception is thrown - Setting current directory: No such file or directory, /path/to/git/repo/^M/
. I.e. there is an extra carriage return character inserted on the end of the path as though it were another directory level.
For the avoidance of doubt, this is not about carriage returns in a repository file, but rather the path to the repository. Emacs is running on windows, with git for windows.
Error trace below:
Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "c:/emacs/home/temp/\015/")
call-process("c:/Program Files/Git/git-cmd.exe" nil (t nil) nil "--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z")
apply(call-process "c:/Program Files/Git/git-cmd.exe" nil (t nil) nil ("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z"))
process-file("c:/Program Files/Git/git-cmd.exe" nil (t nil) nil "--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z")
apply(process-file "c:/Program Files/Git/git-cmd.exe" nil (t nil) nil ("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z"))
magit-process-file("c:/Program Files/Git/git-cmd.exe" nil (t nil) nil "--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z")
apply(magit-process-file "c:/Program Files/Git/git-cmd.exe" nil (t nil) nil ("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z"))
magit-git-insert("config" "--list" "-z")
apply(magit-git-insert ("config" "--list" "-z"))
magit-git-items("config" "--list" "-z")
magit-config-get-from-cached-list("magit.extension")
magit-get-all("magit.extension")
magit-load-config-extensions()
run-hooks(change-major-mode-after-body-hook special-mode-hook magit-mode-hook magit-status-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook special-mode-hook magit-mode-hook magit-status-mode-hook))
run-mode-hooks(magit-status-mode-hook)
magit-status-mode()
magit-setup-buffer-internal(magit-status-mode nil ((magit-buffer-diff-args ("--no-ext-diff")) (magit-buffer-diff-files nil) (magit-buffer-log-args ("-n256" "--decorate")) (magit-buffer-log-files nil)))
magit-status-setup-buffer("c:/emacs/home/temp/")
magit-status(nil ((4 . 4) (("c:/emacs/home/temp/\015/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" "rev-parse" "--show-toplevel") . "\015")))
funcall-interactively(magit-status nil ((4 . 4) (("c:/emacs/home/temp/\015/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" "rev-parse" "--show-toplevel") . "\015")))
call-interactively(magit-status record nil)
command-execute(magit-status record)
helm-M-x(nil #("magit-status" 0 12 (match-part "magit-status")))
funcall-interactively(helm-M-x nil #("magit-status" 0 12 (match-part "magit-status")))
call-interactively(helm-M-x nil nil)
command-execute(helm-M-x)
C-h v default-directory
in that buffer? (You've mentioned the variable, but haven't confirmed that it's relevant). If the buffer you're callingmagit-status
from already has an invaliddefault-directory
, then it's not really a Magit issue. If it's only the Magit status buffer that has the invalid value, please clarify.M-x toggle-debug-on-error
and then add the stack trace to the question?default-directory
seems to have the path as I would expect - no extra carriage returns.default-directory is a variable defined in ‘C source code’. Its value is "c:/emacs/home/temp/"
Magit-repository-directories
has a value ofnil