branch: elpa/magit
commit 11a8538541efb02bf4ec875c9ff51f2da6ade820
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-gitignore-read-pattern: Respect DIRECTORY
---
lisp/magit-gitignore.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lisp/magit-gitignore.el b/lisp/magit-gitignore.el
index dc53383751..e685b82640 100644
--- a/lisp/magit-gitignore.el
+++ b/lisp/magit-gitignore.el
@@ -112,6 +112,11 @@ Rules that are defined in that file affect all local
repositories."
(let ((choices (magit--gitignore-patterns directory))
(default (magit-current-file)))
(when default
+ (when directory
+ (setq default
+ (substring default
+ (length
+ (file-relative-name directory (magit-toplevel))))))
(setq default (concat "/" default))
(unless (member default choices)
(setq default (concat "*." (file-name-extension default)))