branch: elpa/magit
commit 28878dd879aa2591b971a09848fdf800e92f3a2b
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit-gitignore-in-subdir: Pick up initial directory from current file
---
 lisp/magit-gitignore.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-gitignore.el b/lisp/magit-gitignore.el
index e685b82640..8fd239b6ce 100644
--- a/lisp/magit-gitignore.el
+++ b/lisp/magit-gitignore.el
@@ -66,7 +66,11 @@ tracked, they are shared with other clones of the repository.
 Also stage the file."
   :description "shared in subdirectory (path/to/.gitignore)"
   (interactive (let ((dir (expand-file-name
-                           (read-directory-name "Limit rule to files in: "))))
+                           (read-directory-name
+                            "Limit rule to files in: "
+                            (and$ (magit-current-file)
+                                  (file-name-directory
+                                   (expand-file-name $ (magit-toplevel))))))))
                  (list (magit-gitignore-read-pattern dir) dir)))
   (magit--gitignore rule (expand-file-name ".gitignore" directory) t))
 

Reply via email to