4

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 1

1

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))))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.