Commit 5f407a29 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-gitdir: New function

This is intended as a replacement for `magit-git-dir', whose
argument is weird.  For now `magit-gitdir' is just a wrapper
and `magit-git-dir' isn't deprecated yet.
parent 53b4f70e
......@@ -428,6 +428,16 @@ call function WASHER with ARGS as its sole argument."
`(when-let ((default-directory (magit--safe-default-directory ,file)))
,@body))
(defun magit-gitdir (&optional directory)
"Return the absolute and resolved path of the .git directory.
If the `GIT_DIR' environment variable is define then return that.
Otherwise return the .git directory for DIRECTORY, or if that is
nil, then for `default-directory' instead. If the directory is
not located inside a Git repository, then return nil."
(let ((default-directory (or directory default-directory)))
(magit-git-dir)))
(defun magit-git-dir (&optional path)
"Return the absolute and resolved path of the .git directory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment