I would like to determine if the current directory/file is ignored by .gitignore
with vc
. In this case, only git
matters, but of course a general solution would be appreciated.
1 Answer
I'm afraid there is no such API in vc-mode or magit, but with little elisp you can implement all by yourself:
(defun my/is-git-ignored (file)
(interactive "fFile:")
(not (string-empty-p
(shell-command-to-string (concat "git check-ignore " (shell-quote-argument file))))))